diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 7519fa3a..eecb84c2 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:0e18b9475fbeb12d9ad4302283171edebb6baf2dfca1bd215ee3b34ed79d95d7 + digest: sha256:ae600f36b6bc972b368367b6f83a1d91ec2c82a4a116b383d67d547c56fe6de3 diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 44cc8685..e446644f 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -8,5 +8,5 @@ # @googleapis/yoshi-python is the default owner for changes in this repo * @googleapis/yoshi-python -# @googleapis/python-samples-owners is the default owner for samples changes -/samples/ @googleapis/python-samples-owners +# @googleapis/python-samples-reviewers is the default owner for samples changes +/samples/ @googleapis/python-samples-reviewers diff --git a/.github/release-please.yml b/.github/release-please.yml index 4507ad05..466597e5 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -1 +1,2 @@ releaseType: python +handleGHRelease: true diff --git a/.github/release-trigger.yml b/.github/release-trigger.yml new file mode 100644 index 00000000..d4ca9418 --- /dev/null +++ b/.github/release-trigger.yml @@ -0,0 +1 @@ +enabled: true diff --git a/.kokoro/release.sh b/.kokoro/release.sh index 17ac130f..3da6fae3 100755 --- a/.kokoro/release.sh +++ b/.kokoro/release.sh @@ -26,7 +26,7 @@ python3 -m pip install --upgrade twine wheel setuptools export PYTHONUNBUFFERED=1 # Move into the package, build the distribution and upload. -TWINE_PASSWORD=$(cat "${KOKORO_GFILE_DIR}/secret_manager/google-cloud-pypi-token") +TWINE_PASSWORD=$(cat "${KOKORO_KEYSTORE_DIR}/73713_google-cloud-pypi-token-keystore-1") cd github/python-dlp python3 setup.py sdist bdist_wheel twine upload --username __token__ --password "${TWINE_PASSWORD}" dist/* diff --git a/.kokoro/release/common.cfg b/.kokoro/release/common.cfg index 2f620e6c..28658228 100644 --- a/.kokoro/release/common.cfg +++ b/.kokoro/release/common.cfg @@ -23,8 +23,18 @@ env_vars: { value: "github/python-dlp/.kokoro/release.sh" } +# Fetch PyPI password +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "google-cloud-pypi-token-keystore-1" + } + } +} + # Tokens needed to report release status back to GitHub env_vars: { key: "SECRET_MANAGER_KEYS" - value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem,google-cloud-pypi-token" + value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" } diff --git a/.repo-metadata.json b/.repo-metadata.json index 791196d7..14dd992e 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -4,7 +4,7 @@ "product_documentation": "https://cloud.google.com/dlp/docs/", "client_documentation": "https://cloud.google.com/python/docs/reference/dlp/latest", "issue_tracker": "", - "release_level": "ga", + "release_level": "stable", "language": "python", "library_type": "GAPIC_AUTO", "repo": "googleapis/python-dlp", @@ -12,5 +12,6 @@ "api_id": "dlp.googleapis.com", "requires_billing": true, "default_version": "v2", - "codeowner_team": "" + "codeowner_team": "", + "api_shortname": "dlp" } diff --git a/CHANGELOG.md b/CHANGELOG.md index a73bd8eb..ed0478f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ [1]: https://pypi.org/project/google-cloud-dlp/#history +## [3.5.0](https://github.com/googleapis/python-dlp/compare/v3.4.0...v3.5.0) (2022-01-16) + + +### Features + +* add support for Python 3.9 / 3.10 ([#300](https://github.com/googleapis/python-dlp/issues/300)) ([ac58bde](https://github.com/googleapis/python-dlp/commit/ac58bde1f9d361f56ecf942319d1c427159a02e9)) + ## [3.4.0](https://www.github.com/googleapis/python-dlp/compare/v3.3.1...v3.4.0) (2021-12-03) diff --git a/google/cloud/dlp_v2/services/dlp_service/transports/base.py b/google/cloud/dlp_v2/services/dlp_service/transports/base.py index 2447936f..b15bbaf5 100644 --- a/google/cloud/dlp_v2/services/dlp_service/transports/base.py +++ b/google/cloud/dlp_v2/services/dlp_service/transports/base.py @@ -100,7 +100,6 @@ def __init__( credentials, _ = google.auth.load_credentials_from_file( credentials_file, **scopes_kwargs, quota_project_id=quota_project_id ) - elif credentials is None: credentials, _ = google.auth.default( **scopes_kwargs, quota_project_id=quota_project_id diff --git a/samples/snippets/noxfile.py b/samples/snippets/noxfile.py index 93a9122c..3bbef5d5 100644 --- a/samples/snippets/noxfile.py +++ b/samples/snippets/noxfile.py @@ -14,6 +14,7 @@ from __future__ import print_function +import glob import os from pathlib import Path import sys @@ -184,37 +185,44 @@ def blacken(session: nox.sessions.Session) -> None: def _session_tests( session: nox.sessions.Session, post_install: Callable = None ) -> None: - if TEST_CONFIG["pip_version_override"]: - pip_version = TEST_CONFIG["pip_version_override"] - session.install(f"pip=={pip_version}") - """Runs py.test for a particular project.""" - if os.path.exists("requirements.txt"): - if os.path.exists("constraints.txt"): - session.install("-r", "requirements.txt", "-c", "constraints.txt") - else: - session.install("-r", "requirements.txt") - - if os.path.exists("requirements-test.txt"): - if os.path.exists("constraints-test.txt"): - session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt") - else: - session.install("-r", "requirements-test.txt") - - if INSTALL_LIBRARY_FROM_SOURCE: - session.install("-e", _get_repo_root()) - - if post_install: - post_install(session) - - session.run( - "pytest", - *(PYTEST_COMMON_ARGS + session.posargs), - # Pytest will return 5 when no tests are collected. This can happen - # on travis where slow and flaky tests are excluded. - # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html - success_codes=[0, 5], - env=get_pytest_env_vars(), - ) + # check for presence of tests + test_list = glob.glob("*_test.py") + glob.glob("test_*.py") + if len(test_list) == 0: + print("No tests found, skipping directory.") + else: + if TEST_CONFIG["pip_version_override"]: + pip_version = TEST_CONFIG["pip_version_override"] + session.install(f"pip=={pip_version}") + """Runs py.test for a particular project.""" + if os.path.exists("requirements.txt"): + if os.path.exists("constraints.txt"): + session.install("-r", "requirements.txt", "-c", "constraints.txt") + else: + session.install("-r", "requirements.txt") + + if os.path.exists("requirements-test.txt"): + if os.path.exists("constraints-test.txt"): + session.install( + "-r", "requirements-test.txt", "-c", "constraints-test.txt" + ) + else: + session.install("-r", "requirements-test.txt") + + if INSTALL_LIBRARY_FROM_SOURCE: + session.install("-e", _get_repo_root()) + + if post_install: + post_install(session) + + session.run( + "pytest", + *(PYTEST_COMMON_ARGS + session.posargs), + # Pytest will return 5 when no tests are collected. This can happen + # on travis where slow and flaky tests are excluded. + # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html + success_codes=[0, 5], + env=get_pytest_env_vars(), + ) @nox.session(python=ALL_VERSIONS) diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt index ff67fa59..a0d8e871 100644 --- a/samples/snippets/requirements.txt +++ b/samples/snippets/requirements.txt @@ -1,5 +1,5 @@ -google-cloud-dlp==3.3.1 -google-cloud-storage==1.43.0 +google-cloud-dlp==3.4.0 +google-cloud-storage==2.0.0 google-cloud-pubsub==2.9.0 google-cloud-datastore==2.4.0 -google-cloud-bigquery==2.30.1 +google-cloud-bigquery==2.32.0 diff --git a/setup.py b/setup.py index 888d7213..46183550 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ name = "google-cloud-dlp" description = "Cloud Data Loss Prevention (DLP) API API client library" -version = "3.4.0" +version = "3.5.0" release_status = "Development Status :: 5 - Production/Stable" dependencies = [ # NOTE: Maintainers, please do not require google-api-core>=2.x.x @@ -68,6 +68,8 @@ "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", "Operating System :: OS Independent", "Topic :: Internet", ], diff --git a/tests/unit/gapic/dlp_v2/test_dlp_service.py b/tests/unit/gapic/dlp_v2/test_dlp_service.py index f7b16eba..ef2d7f34 100644 --- a/tests/unit/gapic/dlp_v2/test_dlp_service.py +++ b/tests/unit/gapic/dlp_v2/test_dlp_service.py @@ -246,20 +246,20 @@ def test_dlp_service_client_client_options( # unsupported value. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): with pytest.raises(MutualTLSChannelError): - client = client_class() + client = client_class(transport=transport_name) # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. with mock.patch.dict( os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} ): with pytest.raises(ValueError): - client = client_class() + client = client_class(transport=transport_name) # Check the case quota_project_id is provided options = client_options.ClientOptions(quota_project_id="octopus") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -316,7 +316,7 @@ def test_dlp_service_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) if use_client_cert_env == "false": expected_client_cert_source = None @@ -411,7 +411,7 @@ def test_dlp_service_client_client_options_scopes( options = client_options.ClientOptions(scopes=["1", "2"],) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -442,7 +442,7 @@ def test_dlp_service_client_client_options_credentials_file( options = client_options.ClientOptions(credentials_file="credentials.json") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -473,9 +473,8 @@ def test_dlp_service_client_client_options_from_dict(): ) -def test_inspect_content( - transport: str = "grpc", request_type=dlp.InspectContentRequest -): +@pytest.mark.parametrize("request_type", [dlp.InspectContentRequest, dict,]) +def test_inspect_content(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -499,10 +498,6 @@ def test_inspect_content( assert isinstance(response, dlp.InspectContentResponse) -def test_inspect_content_from_dict(): - test_inspect_content(request_type=dict) - - def test_inspect_content_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -603,7 +598,8 @@ async def test_inspect_content_field_headers_async(): assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] -def test_redact_image(transport: str = "grpc", request_type=dlp.RedactImageRequest): +@pytest.mark.parametrize("request_type", [dlp.RedactImageRequest, dict,]) +def test_redact_image(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -632,10 +628,6 @@ def test_redact_image(transport: str = "grpc", request_type=dlp.RedactImageReque assert response.extracted_text == "extracted_text_value" -def test_redact_image_from_dict(): - test_redact_image(request_type=dict) - - def test_redact_image_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -741,9 +733,8 @@ async def test_redact_image_field_headers_async(): assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] -def test_deidentify_content( - transport: str = "grpc", request_type=dlp.DeidentifyContentRequest -): +@pytest.mark.parametrize("request_type", [dlp.DeidentifyContentRequest, dict,]) +def test_deidentify_content(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -769,10 +760,6 @@ def test_deidentify_content( assert isinstance(response, dlp.DeidentifyContentResponse) -def test_deidentify_content_from_dict(): - test_deidentify_content(request_type=dict) - - def test_deidentify_content_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -881,9 +868,8 @@ async def test_deidentify_content_field_headers_async(): assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] -def test_reidentify_content( - transport: str = "grpc", request_type=dlp.ReidentifyContentRequest -): +@pytest.mark.parametrize("request_type", [dlp.ReidentifyContentRequest, dict,]) +def test_reidentify_content(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -909,10 +895,6 @@ def test_reidentify_content( assert isinstance(response, dlp.ReidentifyContentResponse) -def test_reidentify_content_from_dict(): - test_reidentify_content(request_type=dict) - - def test_reidentify_content_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -1021,9 +1003,8 @@ async def test_reidentify_content_field_headers_async(): assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] -def test_list_info_types( - transport: str = "grpc", request_type=dlp.ListInfoTypesRequest -): +@pytest.mark.parametrize("request_type", [dlp.ListInfoTypesRequest, dict,]) +def test_list_info_types(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1047,10 +1028,6 @@ def test_list_info_types( assert isinstance(response, dlp.ListInfoTypesResponse) -def test_list_info_types_from_dict(): - test_list_info_types(request_type=dict) - - def test_list_info_types_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -1168,9 +1145,8 @@ async def test_list_info_types_flattened_error_async(): ) -def test_create_inspect_template( - transport: str = "grpc", request_type=dlp.CreateInspectTemplateRequest -): +@pytest.mark.parametrize("request_type", [dlp.CreateInspectTemplateRequest, dict,]) +def test_create_inspect_template(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1203,10 +1179,6 @@ def test_create_inspect_template( assert response.description == "description_value" -def test_create_inspect_template_from_dict(): - test_create_inspect_template(request_type=dict) - - def test_create_inspect_template_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -1406,9 +1378,8 @@ async def test_create_inspect_template_flattened_error_async(): ) -def test_update_inspect_template( - transport: str = "grpc", request_type=dlp.UpdateInspectTemplateRequest -): +@pytest.mark.parametrize("request_type", [dlp.UpdateInspectTemplateRequest, dict,]) +def test_update_inspect_template(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1441,10 +1412,6 @@ def test_update_inspect_template( assert response.description == "description_value" -def test_update_inspect_template_from_dict(): - test_update_inspect_template(request_type=dict) - - def test_update_inspect_template_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -1654,9 +1621,8 @@ async def test_update_inspect_template_flattened_error_async(): ) -def test_get_inspect_template( - transport: str = "grpc", request_type=dlp.GetInspectTemplateRequest -): +@pytest.mark.parametrize("request_type", [dlp.GetInspectTemplateRequest, dict,]) +def test_get_inspect_template(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1689,10 +1655,6 @@ def test_get_inspect_template( assert response.description == "description_value" -def test_get_inspect_template_from_dict(): - test_get_inspect_template(request_type=dict) - - def test_get_inspect_template_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -1876,9 +1838,8 @@ async def test_get_inspect_template_flattened_error_async(): ) -def test_list_inspect_templates( - transport: str = "grpc", request_type=dlp.ListInspectTemplatesRequest -): +@pytest.mark.parametrize("request_type", [dlp.ListInspectTemplatesRequest, dict,]) +def test_list_inspect_templates(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1907,10 +1868,6 @@ def test_list_inspect_templates( assert response.next_page_token == "next_page_token_value" -def test_list_inspect_templates_from_dict(): - test_list_inspect_templates(request_type=dict) - - def test_list_inspect_templates_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -2092,8 +2049,10 @@ async def test_list_inspect_templates_flattened_error_async(): ) -def test_list_inspect_templates_pager(): - client = DlpServiceClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_inspect_templates_pager(transport_name: str = "grpc"): + client = DlpServiceClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2134,8 +2093,10 @@ def test_list_inspect_templates_pager(): assert all(isinstance(i, dlp.InspectTemplate) for i in results) -def test_list_inspect_templates_pages(): - client = DlpServiceClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_inspect_templates_pages(transport_name: str = "grpc"): + client = DlpServiceClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2246,9 +2207,8 @@ async def test_list_inspect_templates_async_pages(): assert page_.raw_page.next_page_token == token -def test_delete_inspect_template( - transport: str = "grpc", request_type=dlp.DeleteInspectTemplateRequest -): +@pytest.mark.parametrize("request_type", [dlp.DeleteInspectTemplateRequest, dict,]) +def test_delete_inspect_template(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2274,10 +2234,6 @@ def test_delete_inspect_template( assert response is None -def test_delete_inspect_template_from_dict(): - test_delete_inspect_template(request_type=dict) - - def test_delete_inspect_template_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -2452,9 +2408,8 @@ async def test_delete_inspect_template_flattened_error_async(): ) -def test_create_deidentify_template( - transport: str = "grpc", request_type=dlp.CreateDeidentifyTemplateRequest -): +@pytest.mark.parametrize("request_type", [dlp.CreateDeidentifyTemplateRequest, dict,]) +def test_create_deidentify_template(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2487,10 +2442,6 @@ def test_create_deidentify_template( assert response.description == "description_value" -def test_create_deidentify_template_from_dict(): - test_create_deidentify_template(request_type=dict) - - def test_create_deidentify_template_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -2694,9 +2645,8 @@ async def test_create_deidentify_template_flattened_error_async(): ) -def test_update_deidentify_template( - transport: str = "grpc", request_type=dlp.UpdateDeidentifyTemplateRequest -): +@pytest.mark.parametrize("request_type", [dlp.UpdateDeidentifyTemplateRequest, dict,]) +def test_update_deidentify_template(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2729,10 +2679,6 @@ def test_update_deidentify_template( assert response.description == "description_value" -def test_update_deidentify_template_from_dict(): - test_update_deidentify_template(request_type=dict) - - def test_update_deidentify_template_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -2946,9 +2892,8 @@ async def test_update_deidentify_template_flattened_error_async(): ) -def test_get_deidentify_template( - transport: str = "grpc", request_type=dlp.GetDeidentifyTemplateRequest -): +@pytest.mark.parametrize("request_type", [dlp.GetDeidentifyTemplateRequest, dict,]) +def test_get_deidentify_template(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2981,10 +2926,6 @@ def test_get_deidentify_template( assert response.description == "description_value" -def test_get_deidentify_template_from_dict(): - test_get_deidentify_template(request_type=dict) - - def test_get_deidentify_template_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -3172,9 +3113,8 @@ async def test_get_deidentify_template_flattened_error_async(): ) -def test_list_deidentify_templates( - transport: str = "grpc", request_type=dlp.ListDeidentifyTemplatesRequest -): +@pytest.mark.parametrize("request_type", [dlp.ListDeidentifyTemplatesRequest, dict,]) +def test_list_deidentify_templates(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3203,10 +3143,6 @@ def test_list_deidentify_templates( assert response.next_page_token == "next_page_token_value" -def test_list_deidentify_templates_from_dict(): - test_list_deidentify_templates(request_type=dict) - - def test_list_deidentify_templates_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -3390,8 +3326,10 @@ async def test_list_deidentify_templates_flattened_error_async(): ) -def test_list_deidentify_templates_pager(): - client = DlpServiceClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_deidentify_templates_pager(transport_name: str = "grpc"): + client = DlpServiceClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3435,8 +3373,10 @@ def test_list_deidentify_templates_pager(): assert all(isinstance(i, dlp.DeidentifyTemplate) for i in results) -def test_list_deidentify_templates_pages(): - client = DlpServiceClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_deidentify_templates_pages(transport_name: str = "grpc"): + client = DlpServiceClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3556,9 +3496,8 @@ async def test_list_deidentify_templates_async_pages(): assert page_.raw_page.next_page_token == token -def test_delete_deidentify_template( - transport: str = "grpc", request_type=dlp.DeleteDeidentifyTemplateRequest -): +@pytest.mark.parametrize("request_type", [dlp.DeleteDeidentifyTemplateRequest, dict,]) +def test_delete_deidentify_template(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3584,10 +3523,6 @@ def test_delete_deidentify_template( assert response is None -def test_delete_deidentify_template_from_dict(): - test_delete_deidentify_template(request_type=dict) - - def test_delete_deidentify_template_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -3762,9 +3697,8 @@ async def test_delete_deidentify_template_flattened_error_async(): ) -def test_create_job_trigger( - transport: str = "grpc", request_type=dlp.CreateJobTriggerRequest -): +@pytest.mark.parametrize("request_type", [dlp.CreateJobTriggerRequest, dict,]) +def test_create_job_trigger(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3806,10 +3740,6 @@ def test_create_job_trigger( assert response.status == dlp.JobTrigger.Status.HEALTHY -def test_create_job_trigger_from_dict(): - test_create_job_trigger(request_type=dict) - - def test_create_job_trigger_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -4009,9 +3939,8 @@ async def test_create_job_trigger_flattened_error_async(): ) -def test_update_job_trigger( - transport: str = "grpc", request_type=dlp.UpdateJobTriggerRequest -): +@pytest.mark.parametrize("request_type", [dlp.UpdateJobTriggerRequest, dict,]) +def test_update_job_trigger(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4053,10 +3982,6 @@ def test_update_job_trigger( assert response.status == dlp.JobTrigger.Status.HEALTHY -def test_update_job_trigger_from_dict(): - test_update_job_trigger(request_type=dict) - - def test_update_job_trigger_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -4268,9 +4193,8 @@ async def test_update_job_trigger_flattened_error_async(): ) -def test_hybrid_inspect_job_trigger( - transport: str = "grpc", request_type=dlp.HybridInspectJobTriggerRequest -): +@pytest.mark.parametrize("request_type", [dlp.HybridInspectJobTriggerRequest, dict,]) +def test_hybrid_inspect_job_trigger(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4296,10 +4220,6 @@ def test_hybrid_inspect_job_trigger( assert isinstance(response, dlp.HybridInspectResponse) -def test_hybrid_inspect_job_trigger_from_dict(): - test_hybrid_inspect_job_trigger(request_type=dict) - - def test_hybrid_inspect_job_trigger_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -4480,9 +4400,8 @@ async def test_hybrid_inspect_job_trigger_flattened_error_async(): ) -def test_get_job_trigger( - transport: str = "grpc", request_type=dlp.GetJobTriggerRequest -): +@pytest.mark.parametrize("request_type", [dlp.GetJobTriggerRequest, dict,]) +def test_get_job_trigger(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4522,10 +4441,6 @@ def test_get_job_trigger( assert response.status == dlp.JobTrigger.Status.HEALTHY -def test_get_job_trigger_from_dict(): - test_get_job_trigger(request_type=dict) - - def test_get_job_trigger_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -4699,9 +4614,8 @@ async def test_get_job_trigger_flattened_error_async(): ) -def test_list_job_triggers( - transport: str = "grpc", request_type=dlp.ListJobTriggersRequest -): +@pytest.mark.parametrize("request_type", [dlp.ListJobTriggersRequest, dict,]) +def test_list_job_triggers(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4730,10 +4644,6 @@ def test_list_job_triggers( assert response.next_page_token == "next_page_token_value" -def test_list_job_triggers_from_dict(): - test_list_job_triggers(request_type=dict) - - def test_list_job_triggers_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -4915,8 +4825,10 @@ async def test_list_job_triggers_flattened_error_async(): ) -def test_list_job_triggers_pager(): - client = DlpServiceClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_job_triggers_pager(transport_name: str = "grpc"): + client = DlpServiceClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4951,8 +4863,10 @@ def test_list_job_triggers_pager(): assert all(isinstance(i, dlp.JobTrigger) for i in results) -def test_list_job_triggers_pages(): - client = DlpServiceClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_job_triggers_pages(transport_name: str = "grpc"): + client = DlpServiceClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5045,9 +4959,8 @@ async def test_list_job_triggers_async_pages(): assert page_.raw_page.next_page_token == token -def test_delete_job_trigger( - transport: str = "grpc", request_type=dlp.DeleteJobTriggerRequest -): +@pytest.mark.parametrize("request_type", [dlp.DeleteJobTriggerRequest, dict,]) +def test_delete_job_trigger(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5073,10 +4986,6 @@ def test_delete_job_trigger( assert response is None -def test_delete_job_trigger_from_dict(): - test_delete_job_trigger(request_type=dict) - - def test_delete_job_trigger_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -5251,9 +5160,8 @@ async def test_delete_job_trigger_flattened_error_async(): ) -def test_activate_job_trigger( - transport: str = "grpc", request_type=dlp.ActivateJobTriggerRequest -): +@pytest.mark.parametrize("request_type", [dlp.ActivateJobTriggerRequest, dict,]) +def test_activate_job_trigger(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5295,10 +5203,6 @@ def test_activate_job_trigger( assert response.job_trigger_name == "job_trigger_name_value" -def test_activate_job_trigger_from_dict(): - test_activate_job_trigger(request_type=dict) - - def test_activate_job_trigger_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -5414,7 +5318,8 @@ async def test_activate_job_trigger_field_headers_async(): assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] -def test_create_dlp_job(transport: str = "grpc", request_type=dlp.CreateDlpJobRequest): +@pytest.mark.parametrize("request_type", [dlp.CreateDlpJobRequest, dict,]) +def test_create_dlp_job(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5454,10 +5359,6 @@ def test_create_dlp_job(transport: str = "grpc", request_type=dlp.CreateDlpJobRe assert response.job_trigger_name == "job_trigger_name_value" -def test_create_dlp_job_from_dict(): - test_create_dlp_job(request_type=dict) - - def test_create_dlp_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -5707,7 +5608,8 @@ async def test_create_dlp_job_flattened_error_async(): ) -def test_list_dlp_jobs(transport: str = "grpc", request_type=dlp.ListDlpJobsRequest): +@pytest.mark.parametrize("request_type", [dlp.ListDlpJobsRequest, dict,]) +def test_list_dlp_jobs(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5734,10 +5636,6 @@ def test_list_dlp_jobs(transport: str = "grpc", request_type=dlp.ListDlpJobsRequ assert response.next_page_token == "next_page_token_value" -def test_list_dlp_jobs_from_dict(): - test_list_dlp_jobs(request_type=dict) - - def test_list_dlp_jobs_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -5907,8 +5805,10 @@ async def test_list_dlp_jobs_flattened_error_async(): ) -def test_list_dlp_jobs_pager(): - client = DlpServiceClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_dlp_jobs_pager(transport_name: str = "grpc"): + client = DlpServiceClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # 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: @@ -5936,8 +5836,10 @@ def test_list_dlp_jobs_pager(): assert all(isinstance(i, dlp.DlpJob) for i in results) -def test_list_dlp_jobs_pages(): - client = DlpServiceClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_dlp_jobs_pages(transport_name: str = "grpc"): + client = DlpServiceClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # 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: @@ -6009,7 +5911,8 @@ async def test_list_dlp_jobs_async_pages(): assert page_.raw_page.next_page_token == token -def test_get_dlp_job(transport: str = "grpc", request_type=dlp.GetDlpJobRequest): +@pytest.mark.parametrize("request_type", [dlp.GetDlpJobRequest, dict,]) +def test_get_dlp_job(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6049,10 +5952,6 @@ def test_get_dlp_job(transport: str = "grpc", request_type=dlp.GetDlpJobRequest) assert response.job_trigger_name == "job_trigger_name_value" -def test_get_dlp_job_from_dict(): - test_get_dlp_job(request_type=dict) - - def test_get_dlp_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -6226,7 +6125,8 @@ async def test_get_dlp_job_flattened_error_async(): ) -def test_delete_dlp_job(transport: str = "grpc", request_type=dlp.DeleteDlpJobRequest): +@pytest.mark.parametrize("request_type", [dlp.DeleteDlpJobRequest, dict,]) +def test_delete_dlp_job(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6250,10 +6150,6 @@ def test_delete_dlp_job(transport: str = "grpc", request_type=dlp.DeleteDlpJobRe assert response is None -def test_delete_dlp_job_from_dict(): - test_delete_dlp_job(request_type=dict) - - def test_delete_dlp_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -6416,7 +6312,8 @@ async def test_delete_dlp_job_flattened_error_async(): ) -def test_cancel_dlp_job(transport: str = "grpc", request_type=dlp.CancelDlpJobRequest): +@pytest.mark.parametrize("request_type", [dlp.CancelDlpJobRequest, dict,]) +def test_cancel_dlp_job(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6440,10 +6337,6 @@ def test_cancel_dlp_job(transport: str = "grpc", request_type=dlp.CancelDlpJobRe assert response is None -def test_cancel_dlp_job_from_dict(): - test_cancel_dlp_job(request_type=dict) - - def test_cancel_dlp_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -6540,9 +6433,8 @@ async def test_cancel_dlp_job_field_headers_async(): assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] -def test_create_stored_info_type( - transport: str = "grpc", request_type=dlp.CreateStoredInfoTypeRequest -): +@pytest.mark.parametrize("request_type", [dlp.CreateStoredInfoTypeRequest, dict,]) +def test_create_stored_info_type(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6569,10 +6461,6 @@ def test_create_stored_info_type( assert response.name == "name_value" -def test_create_stored_info_type_from_dict(): - test_create_stored_info_type(request_type=dict) - - def test_create_stored_info_type_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -6766,9 +6654,8 @@ async def test_create_stored_info_type_flattened_error_async(): ) -def test_update_stored_info_type( - transport: str = "grpc", request_type=dlp.UpdateStoredInfoTypeRequest -): +@pytest.mark.parametrize("request_type", [dlp.UpdateStoredInfoTypeRequest, dict,]) +def test_update_stored_info_type(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6795,10 +6682,6 @@ def test_update_stored_info_type( assert response.name == "name_value" -def test_update_stored_info_type_from_dict(): - test_update_stored_info_type(request_type=dict) - - def test_update_stored_info_type_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -7002,9 +6885,8 @@ async def test_update_stored_info_type_flattened_error_async(): ) -def test_get_stored_info_type( - transport: str = "grpc", request_type=dlp.GetStoredInfoTypeRequest -): +@pytest.mark.parametrize("request_type", [dlp.GetStoredInfoTypeRequest, dict,]) +def test_get_stored_info_type(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7031,10 +6913,6 @@ def test_get_stored_info_type( assert response.name == "name_value" -def test_get_stored_info_type_from_dict(): - test_get_stored_info_type(request_type=dict) - - def test_get_stored_info_type_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -7212,9 +7090,8 @@ async def test_get_stored_info_type_flattened_error_async(): ) -def test_list_stored_info_types( - transport: str = "grpc", request_type=dlp.ListStoredInfoTypesRequest -): +@pytest.mark.parametrize("request_type", [dlp.ListStoredInfoTypesRequest, dict,]) +def test_list_stored_info_types(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7243,10 +7120,6 @@ def test_list_stored_info_types( assert response.next_page_token == "next_page_token_value" -def test_list_stored_info_types_from_dict(): - test_list_stored_info_types(request_type=dict) - - def test_list_stored_info_types_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -7428,8 +7301,10 @@ async def test_list_stored_info_types_flattened_error_async(): ) -def test_list_stored_info_types_pager(): - client = DlpServiceClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_stored_info_types_pager(transport_name: str = "grpc"): + client = DlpServiceClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7470,8 +7345,10 @@ def test_list_stored_info_types_pager(): assert all(isinstance(i, dlp.StoredInfoType) for i in results) -def test_list_stored_info_types_pages(): - client = DlpServiceClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_stored_info_types_pages(transport_name: str = "grpc"): + client = DlpServiceClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7582,9 +7459,8 @@ async def test_list_stored_info_types_async_pages(): assert page_.raw_page.next_page_token == token -def test_delete_stored_info_type( - transport: str = "grpc", request_type=dlp.DeleteStoredInfoTypeRequest -): +@pytest.mark.parametrize("request_type", [dlp.DeleteStoredInfoTypeRequest, dict,]) +def test_delete_stored_info_type(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7610,10 +7486,6 @@ def test_delete_stored_info_type( assert response is None -def test_delete_stored_info_type_from_dict(): - test_delete_stored_info_type(request_type=dict) - - def test_delete_stored_info_type_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -7788,9 +7660,8 @@ async def test_delete_stored_info_type_flattened_error_async(): ) -def test_hybrid_inspect_dlp_job( - transport: str = "grpc", request_type=dlp.HybridInspectDlpJobRequest -): +@pytest.mark.parametrize("request_type", [dlp.HybridInspectDlpJobRequest, dict,]) +def test_hybrid_inspect_dlp_job(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7816,10 +7687,6 @@ def test_hybrid_inspect_dlp_job( assert isinstance(response, dlp.HybridInspectResponse) -def test_hybrid_inspect_dlp_job_from_dict(): - test_hybrid_inspect_dlp_job(request_type=dict) - - def test_hybrid_inspect_dlp_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -8000,7 +7867,8 @@ async def test_hybrid_inspect_dlp_job_flattened_error_async(): ) -def test_finish_dlp_job(transport: str = "grpc", request_type=dlp.FinishDlpJobRequest): +@pytest.mark.parametrize("request_type", [dlp.FinishDlpJobRequest, dict,]) +def test_finish_dlp_job(request_type, transport: str = "grpc"): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8024,10 +7892,6 @@ def test_finish_dlp_job(transport: str = "grpc", request_type=dlp.FinishDlpJobRe assert response is None -def test_finish_dlp_job_from_dict(): - test_finish_dlp_job(request_type=dict) - - def test_finish_dlp_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -8782,7 +8646,7 @@ def test_parse_common_location_path(): assert expected == actual -def test_client_withDEFAULT_CLIENT_INFO(): +def test_client_with_default_client_info(): client_info = gapic_v1.client_info.ClientInfo() with mock.patch.object( pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy