@@ -124,24 +124,14 @@ def test_cloud_build_client_from_service_account_info(client_class):
124
124
assert client .transport ._host == "cloudbuild.googleapis.com:443"
125
125
126
126
127
- @pytest .mark .parametrize ("client_class" , [CloudBuildClient , CloudBuildAsyncClient ,])
128
- def test_cloud_build_client_service_account_always_use_jwt (client_class ):
129
- with mock .patch .object (
130
- service_account .Credentials , "with_always_use_jwt_access" , create = True
131
- ) as use_jwt :
132
- creds = service_account .Credentials (None , None , None )
133
- client = client_class (credentials = creds )
134
- use_jwt .assert_not_called ()
135
-
136
-
137
127
@pytest .mark .parametrize (
138
128
"transport_class,transport_name" ,
139
129
[
140
130
(transports .CloudBuildGrpcTransport , "grpc" ),
141
131
(transports .CloudBuildGrpcAsyncIOTransport , "grpc_asyncio" ),
142
132
],
143
133
)
144
- def test_cloud_build_client_service_account_always_use_jwt_true (
134
+ def test_cloud_build_client_service_account_always_use_jwt (
145
135
transport_class , transport_name
146
136
):
147
137
with mock .patch .object (
@@ -151,6 +141,13 @@ def test_cloud_build_client_service_account_always_use_jwt_true(
151
141
transport = transport_class (credentials = creds , always_use_jwt_access = True )
152
142
use_jwt .assert_called_once_with (True )
153
143
144
+ with mock .patch .object (
145
+ service_account .Credentials , "with_always_use_jwt_access" , create = True
146
+ ) as use_jwt :
147
+ creds = service_account .Credentials (None , None , None )
148
+ transport = transport_class (credentials = creds , always_use_jwt_access = False )
149
+ use_jwt .assert_not_called ()
150
+
154
151
155
152
@pytest .mark .parametrize ("client_class" , [CloudBuildClient , CloudBuildAsyncClient ,])
156
153
def test_cloud_build_client_from_service_account_file (client_class ):
@@ -227,6 +224,7 @@ def test_cloud_build_client_client_options(
227
224
client_cert_source_for_mtls = None ,
228
225
quota_project_id = None ,
229
226
client_info = transports .base .DEFAULT_CLIENT_INFO ,
227
+ always_use_jwt_access = True ,
230
228
)
231
229
232
230
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -243,6 +241,7 @@ def test_cloud_build_client_client_options(
243
241
client_cert_source_for_mtls = None ,
244
242
quota_project_id = None ,
245
243
client_info = transports .base .DEFAULT_CLIENT_INFO ,
244
+ always_use_jwt_access = True ,
246
245
)
247
246
248
247
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -259,6 +258,7 @@ def test_cloud_build_client_client_options(
259
258
client_cert_source_for_mtls = None ,
260
259
quota_project_id = None ,
261
260
client_info = transports .base .DEFAULT_CLIENT_INFO ,
261
+ always_use_jwt_access = True ,
262
262
)
263
263
264
264
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
@@ -287,6 +287,7 @@ def test_cloud_build_client_client_options(
287
287
client_cert_source_for_mtls = None ,
288
288
quota_project_id = "octopus" ,
289
289
client_info = transports .base .DEFAULT_CLIENT_INFO ,
290
+ always_use_jwt_access = True ,
290
291
)
291
292
292
293
@@ -351,6 +352,7 @@ def test_cloud_build_client_mtls_env_auto(
351
352
client_cert_source_for_mtls = expected_client_cert_source ,
352
353
quota_project_id = None ,
353
354
client_info = transports .base .DEFAULT_CLIENT_INFO ,
355
+ always_use_jwt_access = True ,
354
356
)
355
357
356
358
# Check the case ADC client cert is provided. Whether client cert is used depends on
@@ -384,6 +386,7 @@ def test_cloud_build_client_mtls_env_auto(
384
386
client_cert_source_for_mtls = expected_client_cert_source ,
385
387
quota_project_id = None ,
386
388
client_info = transports .base .DEFAULT_CLIENT_INFO ,
389
+ always_use_jwt_access = True ,
387
390
)
388
391
389
392
# Check the case client_cert_source and ADC client cert are not provided.
@@ -405,6 +408,7 @@ def test_cloud_build_client_mtls_env_auto(
405
408
client_cert_source_for_mtls = None ,
406
409
quota_project_id = None ,
407
410
client_info = transports .base .DEFAULT_CLIENT_INFO ,
411
+ always_use_jwt_access = True ,
408
412
)
409
413
410
414
@@ -435,6 +439,7 @@ def test_cloud_build_client_client_options_scopes(
435
439
client_cert_source_for_mtls = None ,
436
440
quota_project_id = None ,
437
441
client_info = transports .base .DEFAULT_CLIENT_INFO ,
442
+ always_use_jwt_access = True ,
438
443
)
439
444
440
445
@@ -465,6 +470,7 @@ def test_cloud_build_client_client_options_credentials_file(
465
470
client_cert_source_for_mtls = None ,
466
471
quota_project_id = None ,
467
472
client_info = transports .base .DEFAULT_CLIENT_INFO ,
473
+ always_use_jwt_access = True ,
468
474
)
469
475
470
476
@@ -482,6 +488,7 @@ def test_cloud_build_client_client_options_from_dict():
482
488
client_cert_source_for_mtls = None ,
483
489
quota_project_id = None ,
484
490
client_info = transports .base .DEFAULT_CLIENT_INFO ,
491
+ always_use_jwt_access = True ,
485
492
)
486
493
487
494
0 commit comments