Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Commit 8bb0ea5

Browse files
fix: fix lint errors
Signed-off-by: Radhika Agrawal <agrawalradhika@google.com>
1 parent ae799f0 commit 8bb0ea5

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

google/auth/aio/transport/mtls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ async def get_client_cert_and_key(client_cert_callback=None):
219219
if asyncio.iscoroutine(result):
220220
cert, key = await result
221221
else:
222-
cert, key = result
222+
cert, key = result
223223
return True, cert, key
224224

225225
has_cert, cert, key, _ = await get_client_ssl_credentials()

tests/transport/aio/test_sessions_mtls.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
import json
16+
import os
1617
import ssl
1718
from unittest import mock
1819

@@ -32,13 +33,14 @@
3233

3334

3435
class TestSessionsMtls:
36+
@mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"})
3537
@mock.patch("os.path.exists")
3638
@mock.patch(
3739
"builtins.open",
3840
new_callable=mock.mock_open,
3941
read_data=json.dumps(VALID_WORKLOAD_CONFIG),
4042
)
41-
@mock.patch("google.auth.transport._mtls_helper._get_workload_cert_and_key")
43+
@mock.patch("google.auth.aio.transport.mtls.get_client_cert_and_key")
4244
@mock.patch("ssl.create_default_context")
4345
@pytest.mark.asyncio
4446
async def test_configure_mtls_channel(
@@ -49,7 +51,7 @@ async def test_configure_mtls_channel(
4951
valid workload config is mocked.
5052
"""
5153
mock_exists.return_value = True
52-
mock_helper.return_value = (b"fake_cert_data", b"fake_key_data")
54+
mock_helper.return_value = (True, b"fake_cert_data", b"fake_key_data")
5355

5456
mock_context = mock.Mock(spec=ssl.SSLContext)
5557
mock_ssl.return_value = mock_context
@@ -61,6 +63,7 @@ async def test_configure_mtls_channel(
6163
assert session._is_mtls is True
6264
assert mock_context.load_cert_chain.called
6365

66+
@mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"})
6467
@mock.patch("os.path.exists")
6568
@pytest.mark.asyncio
6669
async def test_configure_mtls_channel_disabled(self, mock_exists):
@@ -89,10 +92,10 @@ async def test_configure_mtls_channel_invalid_format(self, mock_file, mock_exist
8992
mock_creds = mock.Mock(spec=credentials.Credentials)
9093

9194
session = sessions.AsyncAuthorizedSession(mock_creds)
92-
with pytest.raises(
93-
exceptions.MutualTLSChannelError):
95+
with pytest.raises(exceptions.MutualTLSChannelError):
9496
await session.configure_mtls_channel()
9597

98+
@mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"})
9699
@pytest.mark.asyncio
97100
@mock.patch(
98101
"google.auth.aio.transport.mtls.has_default_client_cert_source",

0 commit comments

Comments
 (0)