From 19908edcd8a3df1db41e34100acc1f15c3c99397 Mon Sep 17 00:00:00 2001 From: arithmetic1728 <58957152+arithmetic1728@users.noreply.github.com> Date: Tue, 9 Jun 2020 22:32:43 -0700 Subject: [PATCH 1/2] fix: update GOOGLE_API_USE_MTLS values (#940) --- googleapiclient/discovery.py | 14 +++++++------- tests/test_discovery.py | 20 ++++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/googleapiclient/discovery.py b/googleapiclient/discovery.py index 55367c0a491..f12b04f3ad7 100644 --- a/googleapiclient/discovery.py +++ b/googleapiclient/discovery.py @@ -471,17 +471,17 @@ def build_from_document( not client_options or not client_options.api_endpoint ): mtls_endpoint = urljoin(service["mtlsRootUrl"], service["servicePath"]) - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS", "Never") + use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS", "never") - if not use_mtls_env in ("Never", "Auto", "Always"): + if not use_mtls_env in ("never", "auto", "always"): raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS value. Accepted values: Never, Auto, Always" + "Unsupported GOOGLE_API_USE_MTLS value. Accepted values: never, auto, always" ) - # Switch to mTLS endpoint, if environment variable is "Always", or - # environment varibable is "Auto" and client cert exists. - if use_mtls_env == "Always" or ( - use_mtls_env == "Auto" and client_cert_to_use + # Switch to mTLS endpoint, if environment variable is "always", or + # environment varibable is "auto" and client cert exists. + if use_mtls_env == "always" or ( + use_mtls_env == "auto" and client_cert_to_use ): base = mtls_endpoint diff --git a/tests/test_discovery.py b/tests/test_discovery.py index 9015066006a..d6cd9e1d1f3 100644 --- a/tests/test_discovery.py +++ b/tests/test_discovery.py @@ -590,9 +590,9 @@ def test_exception_with_client_cert_source(self): @parameterized.expand( [ - ("Never", REGULAR_ENDPOINT), - ("Auto", MTLS_ENDPOINT), - ("Always", MTLS_ENDPOINT), + ("never", REGULAR_ENDPOINT), + ("auto", MTLS_ENDPOINT), + ("always", MTLS_ENDPOINT), ] ) def test_mtls_with_provided_client_cert(self, use_mtls_env, base_url): @@ -610,7 +610,7 @@ def test_mtls_with_provided_client_cert(self, use_mtls_env, base_url): self.check_http_client_cert(plus, has_client_cert=True) self.assertEqual(plus._baseUrl, base_url) - @parameterized.expand(["Never", "Auto", "Always"]) + @parameterized.expand(["never", "auto", "always"]) def test_endpoint_not_switch(self, use_mtls_env): # Test endpoint is not switched if user provided api endpoint discovery = open(datafile("plus.json")).read() @@ -630,9 +630,9 @@ def test_endpoint_not_switch(self, use_mtls_env): @parameterized.expand( [ - ("Never", REGULAR_ENDPOINT), - ("Auto", MTLS_ENDPOINT), - ("Always", MTLS_ENDPOINT), + ("never", REGULAR_ENDPOINT), + ("auto", MTLS_ENDPOINT), + ("always", MTLS_ENDPOINT), ] ) @mock.patch( @@ -667,9 +667,9 @@ def test_mtls_with_default_client_cert( @parameterized.expand( [ - ("Never", REGULAR_ENDPOINT), - ("Auto", REGULAR_ENDPOINT), - ("Always", MTLS_ENDPOINT), + ("never", REGULAR_ENDPOINT), + ("auto", REGULAR_ENDPOINT), + ("always", MTLS_ENDPOINT), ] ) @mock.patch( From cc83ec24849cf4a004a7fbe612ad05e5806c68d3 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 10 Jun 2020 19:31:19 -0700 Subject: [PATCH 2/2] chore: release 1.9.3 (#941) * updated CHANGELOG.md [ci skip] * updated setup.py Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- CHANGELOG.md | 7 +++++++ setup.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8516e745aa1..fa4ed3074eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [1.9.3](https://www.github.com/googleapis/google-api-python-client/compare/v1.9.2...v1.9.3) (2020-06-10) + + +### Bug Fixes + +* update GOOGLE_API_USE_MTLS values ([#940](https://www.github.com/googleapis/google-api-python-client/issues/940)) ([19908ed](https://www.github.com/googleapis/google-api-python-client/commit/19908edcd8a3df1db41e34100acc1f15c3c99397)) + ### [1.9.2](https://www.github.com/googleapis/google-api-python-client/compare/v1.9.1...v1.9.2) (2020-06-04) diff --git a/setup.py b/setup.py index 31215eb8c9b..22c6cf4a5ff 100644 --- a/setup.py +++ b/setup.py @@ -52,7 +52,7 @@ with io.open(readme_filename, encoding="utf-8") as readme_file: readme = readme_file.read() -version = "1.9.2" +version = "1.9.3" setup( name="google-api-python-client",