Skip to content

Commit 05b0d64

Browse files
committed
update docstring and unit tests
1 parent 8d40f20 commit 05b0d64

3 files changed

Lines changed: 3 additions & 8 deletions

File tree

packages/google-auth/google/auth/transport/_mtls_helper.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ def _get_cert_config_path(certificate_config_path=None, include_context_aware=Tr
441441
certificate_config_path = path.expanduser(certificate_config_path)
442442
if not path.exists(certificate_config_path):
443443
if is_explicit:
444-
_LOGGER.warning(
444+
_LOGGER.debug(
445445
"Certificate configuration file at %s does not exist",
446446
certificate_config_path,
447447
)
@@ -729,7 +729,8 @@ def check_use_client_cert():
729729
will default to False.
730730
If GOOGLE_API_USE_CLIENT_CERTIFICATE is unset, the value will be inferred
731731
as True (auto-enabled) if a workload config file exists (pointed at by
732-
GOOGLE_API_CERTIFICATE_CONFIG or CLOUDSDK_CONTEXT_AWARE_CERTIFICATE_CONFIG_FILE_PATH)
732+
GOOGLE_API_CERTIFICATE_CONFIG or CLOUDSDK_CONTEXT_AWARE_CERTIFICATE_CONFIG_FILE_PATH,
733+
or the default path like ~/.config/gcloud/certificate_config.json)
733734
containing a "workload" section.
734735
Otherwise, it returns False.
735736

packages/google-auth/tests/transport/test_grpc.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -611,19 +611,14 @@ def test_get_client_ssl_credentials_transient_error_retry(
611611
certificate_chain=b"cert", private_key=b"key"
612612
)
613613

614-
@mock.patch(
615-
"google.auth.transport.mtls.has_default_client_cert_source", autospec=True
616-
)
617614
def test_get_client_ssl_credentials_auto_enablement(
618615
self,
619-
mock_has_default_client_cert_source,
620616
mock_check_config_path,
621617
mock_load_json_file,
622618
mock_get_client_ssl_credentials,
623619
mock_ssl_channel_credentials,
624620
):
625621
fake_config_content = '{"version": 1, "cert_configs": {"workload": {"cert_path": "/tmp/mock_cert.pem", "key_path": "/tmp/mock_key.pem"}}}'
626-
mock_has_default_client_cert_source.return_value = True
627622
mock_get_client_ssl_credentials.return_value = (
628623
True,
629624
PUBLIC_CERT_BYTES,

packages/google-auth/tests/transport/test_mtls.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ def side_effect(path):
4949
assert result is True
5050
mock_get_cert.assert_called_once_with(include_context_aware=True)
5151
mock_check.assert_any_call(_mtls_helper.CONTEXT_AWARE_METADATA_PATH)
52-
assert side_effect("non-matching-path") is None
5352

5453

5554
@mock.patch("google.auth.transport._mtls_helper._check_config_path")

0 commit comments

Comments
 (0)