@@ -119,24 +119,14 @@ def test_data_fusion_client_from_service_account_info(client_class):
119119 assert client .transport ._host == "datafusion.googleapis.com:443"
120120
121121
122- @pytest .mark .parametrize ("client_class" , [DataFusionClient , DataFusionAsyncClient ,])
123- def test_data_fusion_client_service_account_always_use_jwt (client_class ):
124- with mock .patch .object (
125- service_account .Credentials , "with_always_use_jwt_access" , create = True
126- ) as use_jwt :
127- creds = service_account .Credentials (None , None , None )
128- client = client_class (credentials = creds )
129- use_jwt .assert_not_called ()
130-
131-
132122@pytest .mark .parametrize (
133123 "transport_class,transport_name" ,
134124 [
135125 (transports .DataFusionGrpcTransport , "grpc" ),
136126 (transports .DataFusionGrpcAsyncIOTransport , "grpc_asyncio" ),
137127 ],
138128)
139- def test_data_fusion_client_service_account_always_use_jwt_true (
129+ def test_data_fusion_client_service_account_always_use_jwt (
140130 transport_class , transport_name
141131):
142132 with mock .patch .object (
@@ -146,6 +136,13 @@ def test_data_fusion_client_service_account_always_use_jwt_true(
146136 transport = transport_class (credentials = creds , always_use_jwt_access = True )
147137 use_jwt .assert_called_once_with (True )
148138
139+ with mock .patch .object (
140+ service_account .Credentials , "with_always_use_jwt_access" , create = True
141+ ) as use_jwt :
142+ creds = service_account .Credentials (None , None , None )
143+ transport = transport_class (credentials = creds , always_use_jwt_access = False )
144+ use_jwt .assert_not_called ()
145+
149146
150147@pytest .mark .parametrize ("client_class" , [DataFusionClient , DataFusionAsyncClient ,])
151148def test_data_fusion_client_from_service_account_file (client_class ):
@@ -222,6 +219,7 @@ def test_data_fusion_client_client_options(
222219 client_cert_source_for_mtls = None ,
223220 quota_project_id = None ,
224221 client_info = transports .base .DEFAULT_CLIENT_INFO ,
222+ always_use_jwt_access = True ,
225223 )
226224
227225 # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -238,6 +236,7 @@ def test_data_fusion_client_client_options(
238236 client_cert_source_for_mtls = None ,
239237 quota_project_id = None ,
240238 client_info = transports .base .DEFAULT_CLIENT_INFO ,
239+ always_use_jwt_access = True ,
241240 )
242241
243242 # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -254,6 +253,7 @@ def test_data_fusion_client_client_options(
254253 client_cert_source_for_mtls = None ,
255254 quota_project_id = None ,
256255 client_info = transports .base .DEFAULT_CLIENT_INFO ,
256+ always_use_jwt_access = True ,
257257 )
258258
259259 # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
@@ -282,6 +282,7 @@ def test_data_fusion_client_client_options(
282282 client_cert_source_for_mtls = None ,
283283 quota_project_id = "octopus" ,
284284 client_info = transports .base .DEFAULT_CLIENT_INFO ,
285+ always_use_jwt_access = True ,
285286 )
286287
287288
@@ -346,6 +347,7 @@ def test_data_fusion_client_mtls_env_auto(
346347 client_cert_source_for_mtls = expected_client_cert_source ,
347348 quota_project_id = None ,
348349 client_info = transports .base .DEFAULT_CLIENT_INFO ,
350+ always_use_jwt_access = True ,
349351 )
350352
351353 # Check the case ADC client cert is provided. Whether client cert is used depends on
@@ -379,6 +381,7 @@ def test_data_fusion_client_mtls_env_auto(
379381 client_cert_source_for_mtls = expected_client_cert_source ,
380382 quota_project_id = None ,
381383 client_info = transports .base .DEFAULT_CLIENT_INFO ,
384+ always_use_jwt_access = True ,
382385 )
383386
384387 # Check the case client_cert_source and ADC client cert are not provided.
@@ -400,6 +403,7 @@ def test_data_fusion_client_mtls_env_auto(
400403 client_cert_source_for_mtls = None ,
401404 quota_project_id = None ,
402405 client_info = transports .base .DEFAULT_CLIENT_INFO ,
406+ always_use_jwt_access = True ,
403407 )
404408
405409
@@ -430,6 +434,7 @@ def test_data_fusion_client_client_options_scopes(
430434 client_cert_source_for_mtls = None ,
431435 quota_project_id = None ,
432436 client_info = transports .base .DEFAULT_CLIENT_INFO ,
437+ always_use_jwt_access = True ,
433438 )
434439
435440
@@ -460,6 +465,7 @@ def test_data_fusion_client_client_options_credentials_file(
460465 client_cert_source_for_mtls = None ,
461466 quota_project_id = None ,
462467 client_info = transports .base .DEFAULT_CLIENT_INFO ,
468+ always_use_jwt_access = True ,
463469 )
464470
465471
@@ -477,6 +483,7 @@ def test_data_fusion_client_client_options_from_dict():
477483 client_cert_source_for_mtls = None ,
478484 quota_project_id = None ,
479485 client_info = transports .base .DEFAULT_CLIENT_INFO ,
486+ always_use_jwt_access = True ,
480487 )
481488
482489
0 commit comments