@@ -119,24 +119,14 @@ def test_eventarc_client_from_service_account_info(client_class):
119119 assert client .transport ._host == "eventarc.googleapis.com:443"
120120
121121
122- @pytest .mark .parametrize ("client_class" , [EventarcClient , EventarcAsyncClient ,])
123- def test_eventarc_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 .EventarcGrpcTransport , "grpc" ),
136126 (transports .EventarcGrpcAsyncIOTransport , "grpc_asyncio" ),
137127 ],
138128)
139- def test_eventarc_client_service_account_always_use_jwt_true (
129+ def test_eventarc_client_service_account_always_use_jwt (
140130 transport_class , transport_name
141131):
142132 with mock .patch .object (
@@ -146,6 +136,13 @@ def test_eventarc_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" , [EventarcClient , EventarcAsyncClient ,])
151148def test_eventarc_client_from_service_account_file (client_class ):
@@ -216,6 +213,7 @@ def test_eventarc_client_client_options(client_class, transport_class, transport
216213 client_cert_source_for_mtls = None ,
217214 quota_project_id = None ,
218215 client_info = transports .base .DEFAULT_CLIENT_INFO ,
216+ always_use_jwt_access = True ,
219217 )
220218
221219 # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -232,6 +230,7 @@ def test_eventarc_client_client_options(client_class, transport_class, transport
232230 client_cert_source_for_mtls = None ,
233231 quota_project_id = None ,
234232 client_info = transports .base .DEFAULT_CLIENT_INFO ,
233+ always_use_jwt_access = True ,
235234 )
236235
237236 # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -248,6 +247,7 @@ def test_eventarc_client_client_options(client_class, transport_class, transport
248247 client_cert_source_for_mtls = None ,
249248 quota_project_id = None ,
250249 client_info = transports .base .DEFAULT_CLIENT_INFO ,
250+ always_use_jwt_access = True ,
251251 )
252252
253253 # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
@@ -276,6 +276,7 @@ def test_eventarc_client_client_options(client_class, transport_class, transport
276276 client_cert_source_for_mtls = None ,
277277 quota_project_id = "octopus" ,
278278 client_info = transports .base .DEFAULT_CLIENT_INFO ,
279+ always_use_jwt_access = True ,
279280 )
280281
281282
@@ -340,6 +341,7 @@ def test_eventarc_client_mtls_env_auto(
340341 client_cert_source_for_mtls = expected_client_cert_source ,
341342 quota_project_id = None ,
342343 client_info = transports .base .DEFAULT_CLIENT_INFO ,
344+ always_use_jwt_access = True ,
343345 )
344346
345347 # Check the case ADC client cert is provided. Whether client cert is used depends on
@@ -373,6 +375,7 @@ def test_eventarc_client_mtls_env_auto(
373375 client_cert_source_for_mtls = expected_client_cert_source ,
374376 quota_project_id = None ,
375377 client_info = transports .base .DEFAULT_CLIENT_INFO ,
378+ always_use_jwt_access = True ,
376379 )
377380
378381 # Check the case client_cert_source and ADC client cert are not provided.
@@ -394,6 +397,7 @@ def test_eventarc_client_mtls_env_auto(
394397 client_cert_source_for_mtls = None ,
395398 quota_project_id = None ,
396399 client_info = transports .base .DEFAULT_CLIENT_INFO ,
400+ always_use_jwt_access = True ,
397401 )
398402
399403
@@ -420,6 +424,7 @@ def test_eventarc_client_client_options_scopes(
420424 client_cert_source_for_mtls = None ,
421425 quota_project_id = None ,
422426 client_info = transports .base .DEFAULT_CLIENT_INFO ,
427+ always_use_jwt_access = True ,
423428 )
424429
425430
@@ -446,6 +451,7 @@ def test_eventarc_client_client_options_credentials_file(
446451 client_cert_source_for_mtls = None ,
447452 quota_project_id = None ,
448453 client_info = transports .base .DEFAULT_CLIENT_INFO ,
454+ always_use_jwt_access = True ,
449455 )
450456
451457
@@ -463,6 +469,7 @@ def test_eventarc_client_client_options_from_dict():
463469 client_cert_source_for_mtls = None ,
464470 quota_project_id = None ,
465471 client_info = transports .base .DEFAULT_CLIENT_INFO ,
472+ always_use_jwt_access = True ,
466473 )
467474
468475
0 commit comments