@@ -133,27 +133,14 @@ def test_managed_identities_service_client_from_service_account_info(client_clas
133
133
assert client .transport ._host == "managedidentities.googleapis.com:443"
134
134
135
135
136
- @pytest .mark .parametrize (
137
- "client_class" ,
138
- [ManagedIdentitiesServiceClient , ManagedIdentitiesServiceAsyncClient ,],
139
- )
140
- def test_managed_identities_service_client_service_account_always_use_jwt (client_class ):
141
- with mock .patch .object (
142
- service_account .Credentials , "with_always_use_jwt_access" , create = True
143
- ) as use_jwt :
144
- creds = service_account .Credentials (None , None , None )
145
- client = client_class (credentials = creds )
146
- use_jwt .assert_not_called ()
147
-
148
-
149
136
@pytest .mark .parametrize (
150
137
"transport_class,transport_name" ,
151
138
[
152
139
(transports .ManagedIdentitiesServiceGrpcTransport , "grpc" ),
153
140
(transports .ManagedIdentitiesServiceGrpcAsyncIOTransport , "grpc_asyncio" ),
154
141
],
155
142
)
156
- def test_managed_identities_service_client_service_account_always_use_jwt_true (
143
+ def test_managed_identities_service_client_service_account_always_use_jwt (
157
144
transport_class , transport_name
158
145
):
159
146
with mock .patch .object (
@@ -163,6 +150,13 @@ def test_managed_identities_service_client_service_account_always_use_jwt_true(
163
150
transport = transport_class (credentials = creds , always_use_jwt_access = True )
164
151
use_jwt .assert_called_once_with (True )
165
152
153
+ with mock .patch .object (
154
+ service_account .Credentials , "with_always_use_jwt_access" , create = True
155
+ ) as use_jwt :
156
+ creds = service_account .Credentials (None , None , None )
157
+ transport = transport_class (credentials = creds , always_use_jwt_access = False )
158
+ use_jwt .assert_not_called ()
159
+
166
160
167
161
@pytest .mark .parametrize (
168
162
"client_class" ,
@@ -252,6 +246,7 @@ def test_managed_identities_service_client_client_options(
252
246
client_cert_source_for_mtls = None ,
253
247
quota_project_id = None ,
254
248
client_info = transports .base .DEFAULT_CLIENT_INFO ,
249
+ always_use_jwt_access = True ,
255
250
)
256
251
257
252
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -268,6 +263,7 @@ def test_managed_identities_service_client_client_options(
268
263
client_cert_source_for_mtls = None ,
269
264
quota_project_id = None ,
270
265
client_info = transports .base .DEFAULT_CLIENT_INFO ,
266
+ always_use_jwt_access = True ,
271
267
)
272
268
273
269
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -284,6 +280,7 @@ def test_managed_identities_service_client_client_options(
284
280
client_cert_source_for_mtls = None ,
285
281
quota_project_id = None ,
286
282
client_info = transports .base .DEFAULT_CLIENT_INFO ,
283
+ always_use_jwt_access = True ,
287
284
)
288
285
289
286
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
@@ -312,6 +309,7 @@ def test_managed_identities_service_client_client_options(
312
309
client_cert_source_for_mtls = None ,
313
310
quota_project_id = "octopus" ,
314
311
client_info = transports .base .DEFAULT_CLIENT_INFO ,
312
+ always_use_jwt_access = True ,
315
313
)
316
314
317
315
@@ -388,6 +386,7 @@ def test_managed_identities_service_client_mtls_env_auto(
388
386
client_cert_source_for_mtls = expected_client_cert_source ,
389
387
quota_project_id = None ,
390
388
client_info = transports .base .DEFAULT_CLIENT_INFO ,
389
+ always_use_jwt_access = True ,
391
390
)
392
391
393
392
# Check the case ADC client cert is provided. Whether client cert is used depends on
@@ -421,6 +420,7 @@ def test_managed_identities_service_client_mtls_env_auto(
421
420
client_cert_source_for_mtls = expected_client_cert_source ,
422
421
quota_project_id = None ,
423
422
client_info = transports .base .DEFAULT_CLIENT_INFO ,
423
+ always_use_jwt_access = True ,
424
424
)
425
425
426
426
# Check the case client_cert_source and ADC client cert are not provided.
@@ -442,6 +442,7 @@ def test_managed_identities_service_client_mtls_env_auto(
442
442
client_cert_source_for_mtls = None ,
443
443
quota_project_id = None ,
444
444
client_info = transports .base .DEFAULT_CLIENT_INFO ,
445
+ always_use_jwt_access = True ,
445
446
)
446
447
447
448
@@ -476,6 +477,7 @@ def test_managed_identities_service_client_client_options_scopes(
476
477
client_cert_source_for_mtls = None ,
477
478
quota_project_id = None ,
478
479
client_info = transports .base .DEFAULT_CLIENT_INFO ,
480
+ always_use_jwt_access = True ,
479
481
)
480
482
481
483
@@ -510,6 +512,7 @@ def test_managed_identities_service_client_client_options_credentials_file(
510
512
client_cert_source_for_mtls = None ,
511
513
quota_project_id = None ,
512
514
client_info = transports .base .DEFAULT_CLIENT_INFO ,
515
+ always_use_jwt_access = True ,
513
516
)
514
517
515
518
@@ -529,6 +532,7 @@ def test_managed_identities_service_client_client_options_from_dict():
529
532
client_cert_source_for_mtls = None ,
530
533
quota_project_id = None ,
531
534
client_info = transports .base .DEFAULT_CLIENT_INFO ,
535
+ always_use_jwt_access = True ,
532
536
)
533
537
534
538
0 commit comments