@@ -135,26 +135,14 @@ def test_cloud_functions_service_client_from_service_account_info(client_class):
135
135
assert client .transport ._host == "cloudfunctions.googleapis.com:443"
136
136
137
137
138
- @pytest .mark .parametrize (
139
- "client_class" , [CloudFunctionsServiceClient , CloudFunctionsServiceAsyncClient ,]
140
- )
141
- def test_cloud_functions_service_client_service_account_always_use_jwt (client_class ):
142
- with mock .patch .object (
143
- service_account .Credentials , "with_always_use_jwt_access" , create = True
144
- ) as use_jwt :
145
- creds = service_account .Credentials (None , None , None )
146
- client = client_class (credentials = creds )
147
- use_jwt .assert_not_called ()
148
-
149
-
150
138
@pytest .mark .parametrize (
151
139
"transport_class,transport_name" ,
152
140
[
153
141
(transports .CloudFunctionsServiceGrpcTransport , "grpc" ),
154
142
(transports .CloudFunctionsServiceGrpcAsyncIOTransport , "grpc_asyncio" ),
155
143
],
156
144
)
157
- def test_cloud_functions_service_client_service_account_always_use_jwt_true (
145
+ def test_cloud_functions_service_client_service_account_always_use_jwt (
158
146
transport_class , transport_name
159
147
):
160
148
with mock .patch .object (
@@ -164,6 +152,13 @@ def test_cloud_functions_service_client_service_account_always_use_jwt_true(
164
152
transport = transport_class (credentials = creds , always_use_jwt_access = True )
165
153
use_jwt .assert_called_once_with (True )
166
154
155
+ with mock .patch .object (
156
+ service_account .Credentials , "with_always_use_jwt_access" , create = True
157
+ ) as use_jwt :
158
+ creds = service_account .Credentials (None , None , None )
159
+ transport = transport_class (credentials = creds , always_use_jwt_access = False )
160
+ use_jwt .assert_not_called ()
161
+
167
162
168
163
@pytest .mark .parametrize (
169
164
"client_class" , [CloudFunctionsServiceClient , CloudFunctionsServiceAsyncClient ,]
@@ -248,6 +243,7 @@ def test_cloud_functions_service_client_client_options(
248
243
client_cert_source_for_mtls = None ,
249
244
quota_project_id = None ,
250
245
client_info = transports .base .DEFAULT_CLIENT_INFO ,
246
+ always_use_jwt_access = True ,
251
247
)
252
248
253
249
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -264,6 +260,7 @@ def test_cloud_functions_service_client_client_options(
264
260
client_cert_source_for_mtls = None ,
265
261
quota_project_id = None ,
266
262
client_info = transports .base .DEFAULT_CLIENT_INFO ,
263
+ always_use_jwt_access = True ,
267
264
)
268
265
269
266
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -280,6 +277,7 @@ def test_cloud_functions_service_client_client_options(
280
277
client_cert_source_for_mtls = None ,
281
278
quota_project_id = None ,
282
279
client_info = transports .base .DEFAULT_CLIENT_INFO ,
280
+ always_use_jwt_access = True ,
283
281
)
284
282
285
283
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
@@ -308,6 +306,7 @@ def test_cloud_functions_service_client_client_options(
308
306
client_cert_source_for_mtls = None ,
309
307
quota_project_id = "octopus" ,
310
308
client_info = transports .base .DEFAULT_CLIENT_INFO ,
309
+ always_use_jwt_access = True ,
311
310
)
312
311
313
312
@@ -384,6 +383,7 @@ def test_cloud_functions_service_client_mtls_env_auto(
384
383
client_cert_source_for_mtls = expected_client_cert_source ,
385
384
quota_project_id = None ,
386
385
client_info = transports .base .DEFAULT_CLIENT_INFO ,
386
+ always_use_jwt_access = True ,
387
387
)
388
388
389
389
# Check the case ADC client cert is provided. Whether client cert is used depends on
@@ -417,6 +417,7 @@ def test_cloud_functions_service_client_mtls_env_auto(
417
417
client_cert_source_for_mtls = expected_client_cert_source ,
418
418
quota_project_id = None ,
419
419
client_info = transports .base .DEFAULT_CLIENT_INFO ,
420
+ always_use_jwt_access = True ,
420
421
)
421
422
422
423
# Check the case client_cert_source and ADC client cert are not provided.
@@ -438,6 +439,7 @@ def test_cloud_functions_service_client_mtls_env_auto(
438
439
client_cert_source_for_mtls = None ,
439
440
quota_project_id = None ,
440
441
client_info = transports .base .DEFAULT_CLIENT_INFO ,
442
+ always_use_jwt_access = True ,
441
443
)
442
444
443
445
@@ -472,6 +474,7 @@ def test_cloud_functions_service_client_client_options_scopes(
472
474
client_cert_source_for_mtls = None ,
473
475
quota_project_id = None ,
474
476
client_info = transports .base .DEFAULT_CLIENT_INFO ,
477
+ always_use_jwt_access = True ,
475
478
)
476
479
477
480
@@ -506,6 +509,7 @@ def test_cloud_functions_service_client_client_options_credentials_file(
506
509
client_cert_source_for_mtls = None ,
507
510
quota_project_id = None ,
508
511
client_info = transports .base .DEFAULT_CLIENT_INFO ,
512
+ always_use_jwt_access = True ,
509
513
)
510
514
511
515
@@ -525,6 +529,7 @@ def test_cloud_functions_service_client_client_options_from_dict():
525
529
client_cert_source_for_mtls = None ,
526
530
quota_project_id = None ,
527
531
client_info = transports .base .DEFAULT_CLIENT_INFO ,
532
+ always_use_jwt_access = True ,
528
533
)
529
534
530
535
0 commit comments