3333
3434
3535class TestSessionsMtls :
36+ @pytest .mark .asyncio
3637 @mock .patch .dict (os .environ , {"GOOGLE_API_USE_CLIENT_CERTIFICATE" : "true" })
3738 @mock .patch ("os.path.exists" )
3839 @mock .patch (
@@ -42,7 +43,6 @@ class TestSessionsMtls:
4243 )
4344 @mock .patch ("google.auth.aio.transport.mtls.get_client_cert_and_key" )
4445 @mock .patch ("ssl.create_default_context" )
45- @pytest .mark .asyncio
4646 async def test_configure_mtls_channel (
4747 self , mock_ssl , mock_helper , mock_file , mock_exists
4848 ):
@@ -63,9 +63,9 @@ async def test_configure_mtls_channel(
6363 assert session ._is_mtls is True
6464 assert mock_context .load_cert_chain .called
6565
66+ @pytest .mark .asyncio
6667 @mock .patch .dict (os .environ , {"GOOGLE_API_USE_CLIENT_CERTIFICATE" : "true" })
6768 @mock .patch ("os.path.exists" )
68- @pytest .mark .asyncio
6969 async def test_configure_mtls_channel_disabled (self , mock_exists ):
7070 """
7171 Tests behavior when the config file does not exist.
@@ -79,12 +79,12 @@ async def test_configure_mtls_channel_disabled(self, mock_exists):
7979 # If the file doesn't exist, it shouldn't error; it just won't use mTLS
8080 assert session ._is_mtls is False
8181
82+ @pytest .mark .asyncio
8283 @mock .patch .dict (os .environ , {"GOOGLE_API_USE_CLIENT_CERTIFICATE" : "true" })
8384 @mock .patch ("os.path.exists" )
8485 @mock .patch (
8586 "builtins.open" , new_callable = mock .mock_open , read_data = '{"invalid": "format"}'
8687 )
87- @pytest .mark .asyncio
8888 async def test_configure_mtls_channel_invalid_format (self , mock_file , mock_exists ):
8989 """
9090 Verifies that the MutualTLSChannelError is raised for bad formats.
@@ -96,8 +96,8 @@ async def test_configure_mtls_channel_invalid_format(self, mock_file, mock_exist
9696 with pytest .raises (exceptions .MutualTLSChannelError ):
9797 await session .configure_mtls_channel ()
9898
99- @mock .patch .dict (os .environ , {"GOOGLE_API_USE_CLIENT_CERTIFICATE" : "true" })
10099 @pytest .mark .asyncio
100+ @mock .patch .dict (os .environ , {"GOOGLE_API_USE_CLIENT_CERTIFICATE" : "true" })
101101 @mock .patch (
102102 "google.auth.aio.transport.mtls.has_default_client_cert_source" ,
103103 return_value = True ,
0 commit comments