@@ -119,24 +119,14 @@ def test_eventarc_client_from_service_account_info(client_class):
119
119
assert client .transport ._host == "eventarc.googleapis.com:443"
120
120
121
121
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
-
132
122
@pytest .mark .parametrize (
133
123
"transport_class,transport_name" ,
134
124
[
135
125
(transports .EventarcGrpcTransport , "grpc" ),
136
126
(transports .EventarcGrpcAsyncIOTransport , "grpc_asyncio" ),
137
127
],
138
128
)
139
- def test_eventarc_client_service_account_always_use_jwt_true (
129
+ def test_eventarc_client_service_account_always_use_jwt (
140
130
transport_class , transport_name
141
131
):
142
132
with mock .patch .object (
@@ -146,6 +136,13 @@ def test_eventarc_client_service_account_always_use_jwt_true(
146
136
transport = transport_class (credentials = creds , always_use_jwt_access = True )
147
137
use_jwt .assert_called_once_with (True )
148
138
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
+
149
146
150
147
@pytest .mark .parametrize ("client_class" , [EventarcClient , EventarcAsyncClient ,])
151
148
def test_eventarc_client_from_service_account_file (client_class ):
@@ -216,6 +213,7 @@ def test_eventarc_client_client_options(client_class, transport_class, transport
216
213
client_cert_source_for_mtls = None ,
217
214
quota_project_id = None ,
218
215
client_info = transports .base .DEFAULT_CLIENT_INFO ,
216
+ always_use_jwt_access = True ,
219
217
)
220
218
221
219
# 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
232
230
client_cert_source_for_mtls = None ,
233
231
quota_project_id = None ,
234
232
client_info = transports .base .DEFAULT_CLIENT_INFO ,
233
+ always_use_jwt_access = True ,
235
234
)
236
235
237
236
# 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
248
247
client_cert_source_for_mtls = None ,
249
248
quota_project_id = None ,
250
249
client_info = transports .base .DEFAULT_CLIENT_INFO ,
250
+ always_use_jwt_access = True ,
251
251
)
252
252
253
253
# 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
276
276
client_cert_source_for_mtls = None ,
277
277
quota_project_id = "octopus" ,
278
278
client_info = transports .base .DEFAULT_CLIENT_INFO ,
279
+ always_use_jwt_access = True ,
279
280
)
280
281
281
282
@@ -340,6 +341,7 @@ def test_eventarc_client_mtls_env_auto(
340
341
client_cert_source_for_mtls = expected_client_cert_source ,
341
342
quota_project_id = None ,
342
343
client_info = transports .base .DEFAULT_CLIENT_INFO ,
344
+ always_use_jwt_access = True ,
343
345
)
344
346
345
347
# 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(
373
375
client_cert_source_for_mtls = expected_client_cert_source ,
374
376
quota_project_id = None ,
375
377
client_info = transports .base .DEFAULT_CLIENT_INFO ,
378
+ always_use_jwt_access = True ,
376
379
)
377
380
378
381
# Check the case client_cert_source and ADC client cert are not provided.
@@ -394,6 +397,7 @@ def test_eventarc_client_mtls_env_auto(
394
397
client_cert_source_for_mtls = None ,
395
398
quota_project_id = None ,
396
399
client_info = transports .base .DEFAULT_CLIENT_INFO ,
400
+ always_use_jwt_access = True ,
397
401
)
398
402
399
403
@@ -420,6 +424,7 @@ def test_eventarc_client_client_options_scopes(
420
424
client_cert_source_for_mtls = None ,
421
425
quota_project_id = None ,
422
426
client_info = transports .base .DEFAULT_CLIENT_INFO ,
427
+ always_use_jwt_access = True ,
423
428
)
424
429
425
430
@@ -446,6 +451,7 @@ def test_eventarc_client_client_options_credentials_file(
446
451
client_cert_source_for_mtls = None ,
447
452
quota_project_id = None ,
448
453
client_info = transports .base .DEFAULT_CLIENT_INFO ,
454
+ always_use_jwt_access = True ,
449
455
)
450
456
451
457
@@ -463,6 +469,7 @@ def test_eventarc_client_client_options_from_dict():
463
469
client_cert_source_for_mtls = None ,
464
470
quota_project_id = None ,
465
471
client_info = transports .base .DEFAULT_CLIENT_INFO ,
472
+ always_use_jwt_access = True ,
466
473
)
467
474
468
475
0 commit comments