Skip to content

Commit 88b2fa0

Browse files
committed
chore: update obsolete ClientCertError docstrings and tests
1 parent f8289d2 commit 88b2fa0

2 files changed

Lines changed: 5 additions & 12 deletions

File tree

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

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,7 @@ def default_client_cert_source():
7878
def callback():
7979
try:
8080
_, cert_bytes, key_bytes = _mtls_helper.get_client_cert_and_key()
81-
except (
82-
exceptions.ClientCertError,
83-
OSError,
84-
RuntimeError,
85-
ValueError,
86-
) as caught_exc:
81+
except (OSError, RuntimeError, ValueError) as caught_exc:
8782
new_exc = exceptions.MutualTLSChannelError(caught_exc)
8883
raise new_exc from caught_exc
8984

@@ -225,8 +220,6 @@ def load_default_client_cert(ctx: ssl.SSLContext) -> bool:
225220
are disabled or if no default certificate source is configured.
226221
227222
Raises:
228-
google.auth.exceptions.ClientCertError: If the default client certificate
229-
source exists but cannot be loaded or parsed.
230223
google.auth.exceptions.MutualTLSChannelError: If the default client certificate
231224
or key is malformed.
232225
"""
@@ -262,8 +255,6 @@ def get_default_ssl_context() -> Optional[ssl.SSLContext]:
262255
or available.
263256
264257
Raises:
265-
google.auth.exceptions.ClientCertError: If the default client certificate
266-
source exists but cannot be loaded or parsed.
267258
google.auth.exceptions.MutualTLSChannelError: If the default client certificate
268259
or key is malformed.
269260
"""

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,11 @@ def test_get_default_ssl_context_exception(
377377
mock_has_source.return_value = True
378378
mock_ctx = mock.Mock(spec=ssl.SSLContext)
379379
mock_create_context.return_value = mock_ctx
380-
mock_load_default.side_effect = exceptions.ClientCertError("mock error message")
380+
mock_load_default.side_effect = exceptions.MutualTLSChannelError(
381+
"mock error message"
382+
)
381383

382-
with pytest.raises(exceptions.ClientCertError) as exc_info:
384+
with pytest.raises(exceptions.MutualTLSChannelError) as exc_info:
383385
mtls.get_default_ssl_context()
384386
assert "mock error message" in str(exc_info.value)
385387

0 commit comments

Comments
 (0)