@@ -111,24 +111,14 @@ def test_bigtable_client_from_service_account_info(client_class):
111
111
assert client .transport ._host == "bigtable.googleapis.com:443"
112
112
113
113
114
- @pytest .mark .parametrize ("client_class" , [BigtableClient , BigtableAsyncClient ,])
115
- def test_bigtable_client_service_account_always_use_jwt (client_class ):
116
- with mock .patch .object (
117
- service_account .Credentials , "with_always_use_jwt_access" , create = True
118
- ) as use_jwt :
119
- creds = service_account .Credentials (None , None , None )
120
- client = client_class (credentials = creds )
121
- use_jwt .assert_not_called ()
122
-
123
-
124
114
@pytest .mark .parametrize (
125
115
"transport_class,transport_name" ,
126
116
[
127
117
(transports .BigtableGrpcTransport , "grpc" ),
128
118
(transports .BigtableGrpcAsyncIOTransport , "grpc_asyncio" ),
129
119
],
130
120
)
131
- def test_bigtable_client_service_account_always_use_jwt_true (
121
+ def test_bigtable_client_service_account_always_use_jwt (
132
122
transport_class , transport_name
133
123
):
134
124
with mock .patch .object (
@@ -138,6 +128,13 @@ def test_bigtable_client_service_account_always_use_jwt_true(
138
128
transport = transport_class (credentials = creds , always_use_jwt_access = True )
139
129
use_jwt .assert_called_once_with (True )
140
130
131
+ with mock .patch .object (
132
+ service_account .Credentials , "with_always_use_jwt_access" , create = True
133
+ ) as use_jwt :
134
+ creds = service_account .Credentials (None , None , None )
135
+ transport = transport_class (credentials = creds , always_use_jwt_access = False )
136
+ use_jwt .assert_not_called ()
137
+
141
138
142
139
@pytest .mark .parametrize ("client_class" , [BigtableClient , BigtableAsyncClient ,])
143
140
def test_bigtable_client_from_service_account_file (client_class ):
@@ -208,6 +205,7 @@ def test_bigtable_client_client_options(client_class, transport_class, transport
208
205
client_cert_source_for_mtls = None ,
209
206
quota_project_id = None ,
210
207
client_info = transports .base .DEFAULT_CLIENT_INFO ,
208
+ always_use_jwt_access = True ,
211
209
)
212
210
213
211
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -224,6 +222,7 @@ def test_bigtable_client_client_options(client_class, transport_class, transport
224
222
client_cert_source_for_mtls = None ,
225
223
quota_project_id = None ,
226
224
client_info = transports .base .DEFAULT_CLIENT_INFO ,
225
+ always_use_jwt_access = True ,
227
226
)
228
227
229
228
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -240,6 +239,7 @@ def test_bigtable_client_client_options(client_class, transport_class, transport
240
239
client_cert_source_for_mtls = None ,
241
240
quota_project_id = None ,
242
241
client_info = transports .base .DEFAULT_CLIENT_INFO ,
242
+ always_use_jwt_access = True ,
243
243
)
244
244
245
245
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
@@ -268,6 +268,7 @@ def test_bigtable_client_client_options(client_class, transport_class, transport
268
268
client_cert_source_for_mtls = None ,
269
269
quota_project_id = "octopus" ,
270
270
client_info = transports .base .DEFAULT_CLIENT_INFO ,
271
+ always_use_jwt_access = True ,
271
272
)
272
273
273
274
@@ -332,6 +333,7 @@ def test_bigtable_client_mtls_env_auto(
332
333
client_cert_source_for_mtls = expected_client_cert_source ,
333
334
quota_project_id = None ,
334
335
client_info = transports .base .DEFAULT_CLIENT_INFO ,
336
+ always_use_jwt_access = True ,
335
337
)
336
338
337
339
# Check the case ADC client cert is provided. Whether client cert is used depends on
@@ -365,6 +367,7 @@ def test_bigtable_client_mtls_env_auto(
365
367
client_cert_source_for_mtls = expected_client_cert_source ,
366
368
quota_project_id = None ,
367
369
client_info = transports .base .DEFAULT_CLIENT_INFO ,
370
+ always_use_jwt_access = True ,
368
371
)
369
372
370
373
# Check the case client_cert_source and ADC client cert are not provided.
@@ -386,6 +389,7 @@ def test_bigtable_client_mtls_env_auto(
386
389
client_cert_source_for_mtls = None ,
387
390
quota_project_id = None ,
388
391
client_info = transports .base .DEFAULT_CLIENT_INFO ,
392
+ always_use_jwt_access = True ,
389
393
)
390
394
391
395
@@ -412,6 +416,7 @@ def test_bigtable_client_client_options_scopes(
412
416
client_cert_source_for_mtls = None ,
413
417
quota_project_id = None ,
414
418
client_info = transports .base .DEFAULT_CLIENT_INFO ,
419
+ always_use_jwt_access = True ,
415
420
)
416
421
417
422
@@ -438,6 +443,7 @@ def test_bigtable_client_client_options_credentials_file(
438
443
client_cert_source_for_mtls = None ,
439
444
quota_project_id = None ,
440
445
client_info = transports .base .DEFAULT_CLIENT_INFO ,
446
+ always_use_jwt_access = True ,
441
447
)
442
448
443
449
@@ -455,6 +461,7 @@ def test_bigtable_client_client_options_from_dict():
455
461
client_cert_source_for_mtls = None ,
456
462
quota_project_id = None ,
457
463
client_info = transports .base .DEFAULT_CLIENT_INFO ,
464
+ always_use_jwt_access = True ,
458
465
)
459
466
460
467
0 commit comments