@@ -119,24 +119,14 @@ def test_cloud_redis_client_from_service_account_info(client_class):
119
119
assert client .transport ._host == "redis.googleapis.com:443"
120
120
121
121
122
- @pytest .mark .parametrize ("client_class" , [CloudRedisClient , CloudRedisAsyncClient ,])
123
- def test_cloud_redis_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 .CloudRedisGrpcTransport , "grpc" ),
136
126
(transports .CloudRedisGrpcAsyncIOTransport , "grpc_asyncio" ),
137
127
],
138
128
)
139
- def test_cloud_redis_client_service_account_always_use_jwt_true (
129
+ def test_cloud_redis_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_cloud_redis_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" , [CloudRedisClient , CloudRedisAsyncClient ,])
151
148
def test_cloud_redis_client_from_service_account_file (client_class ):
@@ -222,6 +219,7 @@ def test_cloud_redis_client_client_options(
222
219
client_cert_source_for_mtls = None ,
223
220
quota_project_id = None ,
224
221
client_info = transports .base .DEFAULT_CLIENT_INFO ,
222
+ always_use_jwt_access = True ,
225
223
)
226
224
227
225
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -238,6 +236,7 @@ def test_cloud_redis_client_client_options(
238
236
client_cert_source_for_mtls = None ,
239
237
quota_project_id = None ,
240
238
client_info = transports .base .DEFAULT_CLIENT_INFO ,
239
+ always_use_jwt_access = True ,
241
240
)
242
241
243
242
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -254,6 +253,7 @@ def test_cloud_redis_client_client_options(
254
253
client_cert_source_for_mtls = None ,
255
254
quota_project_id = None ,
256
255
client_info = transports .base .DEFAULT_CLIENT_INFO ,
256
+ always_use_jwt_access = True ,
257
257
)
258
258
259
259
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
@@ -282,6 +282,7 @@ def test_cloud_redis_client_client_options(
282
282
client_cert_source_for_mtls = None ,
283
283
quota_project_id = "octopus" ,
284
284
client_info = transports .base .DEFAULT_CLIENT_INFO ,
285
+ always_use_jwt_access = True ,
285
286
)
286
287
287
288
@@ -346,6 +347,7 @@ def test_cloud_redis_client_mtls_env_auto(
346
347
client_cert_source_for_mtls = expected_client_cert_source ,
347
348
quota_project_id = None ,
348
349
client_info = transports .base .DEFAULT_CLIENT_INFO ,
350
+ always_use_jwt_access = True ,
349
351
)
350
352
351
353
# Check the case ADC client cert is provided. Whether client cert is used depends on
@@ -379,6 +381,7 @@ def test_cloud_redis_client_mtls_env_auto(
379
381
client_cert_source_for_mtls = expected_client_cert_source ,
380
382
quota_project_id = None ,
381
383
client_info = transports .base .DEFAULT_CLIENT_INFO ,
384
+ always_use_jwt_access = True ,
382
385
)
383
386
384
387
# Check the case client_cert_source and ADC client cert are not provided.
@@ -400,6 +403,7 @@ def test_cloud_redis_client_mtls_env_auto(
400
403
client_cert_source_for_mtls = None ,
401
404
quota_project_id = None ,
402
405
client_info = transports .base .DEFAULT_CLIENT_INFO ,
406
+ always_use_jwt_access = True ,
403
407
)
404
408
405
409
@@ -430,6 +434,7 @@ def test_cloud_redis_client_client_options_scopes(
430
434
client_cert_source_for_mtls = None ,
431
435
quota_project_id = None ,
432
436
client_info = transports .base .DEFAULT_CLIENT_INFO ,
437
+ always_use_jwt_access = True ,
433
438
)
434
439
435
440
@@ -460,6 +465,7 @@ def test_cloud_redis_client_client_options_credentials_file(
460
465
client_cert_source_for_mtls = None ,
461
466
quota_project_id = None ,
462
467
client_info = transports .base .DEFAULT_CLIENT_INFO ,
468
+ always_use_jwt_access = True ,
463
469
)
464
470
465
471
@@ -477,6 +483,7 @@ def test_cloud_redis_client_client_options_from_dict():
477
483
client_cert_source_for_mtls = None ,
478
484
quota_project_id = None ,
479
485
client_info = transports .base .DEFAULT_CLIENT_INFO ,
486
+ always_use_jwt_access = True ,
480
487
)
481
488
482
489
0 commit comments