@@ -112,33 +112,28 @@ def test_speech_client_from_service_account_info(client_class):
112112 assert client .transport ._host == "speech.googleapis.com:443"
113113
114114
115- @pytest .mark .parametrize ("client_class" , [SpeechClient , SpeechAsyncClient ,])
116- def test_speech_client_service_account_always_use_jwt (client_class ):
117- with mock .patch .object (
118- service_account .Credentials , "with_always_use_jwt_access" , create = True
119- ) as use_jwt :
120- creds = service_account .Credentials (None , None , None )
121- client = client_class (credentials = creds )
122- use_jwt .assert_not_called ()
123-
124-
125115@pytest .mark .parametrize (
126116 "transport_class,transport_name" ,
127117 [
128118 (transports .SpeechGrpcTransport , "grpc" ),
129119 (transports .SpeechGrpcAsyncIOTransport , "grpc_asyncio" ),
130120 ],
131121)
132- def test_speech_client_service_account_always_use_jwt_true (
133- transport_class , transport_name
134- ):
122+ def test_speech_client_service_account_always_use_jwt (transport_class , transport_name ):
135123 with mock .patch .object (
136124 service_account .Credentials , "with_always_use_jwt_access" , create = True
137125 ) as use_jwt :
138126 creds = service_account .Credentials (None , None , None )
139127 transport = transport_class (credentials = creds , always_use_jwt_access = True )
140128 use_jwt .assert_called_once_with (True )
141129
130+ with mock .patch .object (
131+ service_account .Credentials , "with_always_use_jwt_access" , create = True
132+ ) as use_jwt :
133+ creds = service_account .Credentials (None , None , None )
134+ transport = transport_class (credentials = creds , always_use_jwt_access = False )
135+ use_jwt .assert_not_called ()
136+
142137
143138@pytest .mark .parametrize ("client_class" , [SpeechClient , SpeechAsyncClient ,])
144139def test_speech_client_from_service_account_file (client_class ):
@@ -207,6 +202,7 @@ def test_speech_client_client_options(client_class, transport_class, transport_n
207202 client_cert_source_for_mtls = None ,
208203 quota_project_id = None ,
209204 client_info = transports .base .DEFAULT_CLIENT_INFO ,
205+ always_use_jwt_access = True ,
210206 )
211207
212208 # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -223,6 +219,7 @@ def test_speech_client_client_options(client_class, transport_class, transport_n
223219 client_cert_source_for_mtls = None ,
224220 quota_project_id = None ,
225221 client_info = transports .base .DEFAULT_CLIENT_INFO ,
222+ always_use_jwt_access = True ,
226223 )
227224
228225 # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -239,6 +236,7 @@ def test_speech_client_client_options(client_class, transport_class, transport_n
239236 client_cert_source_for_mtls = None ,
240237 quota_project_id = None ,
241238 client_info = transports .base .DEFAULT_CLIENT_INFO ,
239+ always_use_jwt_access = True ,
242240 )
243241
244242 # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
@@ -267,6 +265,7 @@ def test_speech_client_client_options(client_class, transport_class, transport_n
267265 client_cert_source_for_mtls = None ,
268266 quota_project_id = "octopus" ,
269267 client_info = transports .base .DEFAULT_CLIENT_INFO ,
268+ always_use_jwt_access = True ,
270269 )
271270
272271
@@ -329,6 +328,7 @@ def test_speech_client_mtls_env_auto(
329328 client_cert_source_for_mtls = expected_client_cert_source ,
330329 quota_project_id = None ,
331330 client_info = transports .base .DEFAULT_CLIENT_INFO ,
331+ always_use_jwt_access = True ,
332332 )
333333
334334 # Check the case ADC client cert is provided. Whether client cert is used depends on
@@ -362,6 +362,7 @@ def test_speech_client_mtls_env_auto(
362362 client_cert_source_for_mtls = expected_client_cert_source ,
363363 quota_project_id = None ,
364364 client_info = transports .base .DEFAULT_CLIENT_INFO ,
365+ always_use_jwt_access = True ,
365366 )
366367
367368 # Check the case client_cert_source and ADC client cert are not provided.
@@ -383,6 +384,7 @@ def test_speech_client_mtls_env_auto(
383384 client_cert_source_for_mtls = None ,
384385 quota_project_id = None ,
385386 client_info = transports .base .DEFAULT_CLIENT_INFO ,
387+ always_use_jwt_access = True ,
386388 )
387389
388390
@@ -409,6 +411,7 @@ def test_speech_client_client_options_scopes(
409411 client_cert_source_for_mtls = None ,
410412 quota_project_id = None ,
411413 client_info = transports .base .DEFAULT_CLIENT_INFO ,
414+ always_use_jwt_access = True ,
412415 )
413416
414417
@@ -435,6 +438,7 @@ def test_speech_client_client_options_credentials_file(
435438 client_cert_source_for_mtls = None ,
436439 quota_project_id = None ,
437440 client_info = transports .base .DEFAULT_CLIENT_INFO ,
441+ always_use_jwt_access = True ,
438442 )
439443
440444
@@ -452,6 +456,7 @@ def test_speech_client_client_options_from_dict():
452456 client_cert_source_for_mtls = None ,
453457 quota_project_id = None ,
454458 client_info = transports .base .DEFAULT_CLIENT_INFO ,
459+ always_use_jwt_access = True ,
455460 )
456461
457462
0 commit comments