@@ -131,26 +131,14 @@ def test_data_transfer_service_client_from_service_account_info(client_class):
131
131
assert client .transport ._host == "bigquerydatatransfer.googleapis.com:443"
132
132
133
133
134
- @pytest .mark .parametrize (
135
- "client_class" , [DataTransferServiceClient , DataTransferServiceAsyncClient ,]
136
- )
137
- def test_data_transfer_service_client_service_account_always_use_jwt (client_class ):
138
- with mock .patch .object (
139
- service_account .Credentials , "with_always_use_jwt_access" , create = True
140
- ) as use_jwt :
141
- creds = service_account .Credentials (None , None , None )
142
- client = client_class (credentials = creds )
143
- use_jwt .assert_not_called ()
144
-
145
-
146
134
@pytest .mark .parametrize (
147
135
"transport_class,transport_name" ,
148
136
[
149
137
(transports .DataTransferServiceGrpcTransport , "grpc" ),
150
138
(transports .DataTransferServiceGrpcAsyncIOTransport , "grpc_asyncio" ),
151
139
],
152
140
)
153
- def test_data_transfer_service_client_service_account_always_use_jwt_true (
141
+ def test_data_transfer_service_client_service_account_always_use_jwt (
154
142
transport_class , transport_name
155
143
):
156
144
with mock .patch .object (
@@ -160,6 +148,13 @@ def test_data_transfer_service_client_service_account_always_use_jwt_true(
160
148
transport = transport_class (credentials = creds , always_use_jwt_access = True )
161
149
use_jwt .assert_called_once_with (True )
162
150
151
+ with mock .patch .object (
152
+ service_account .Credentials , "with_always_use_jwt_access" , create = True
153
+ ) as use_jwt :
154
+ creds = service_account .Credentials (None , None , None )
155
+ transport = transport_class (credentials = creds , always_use_jwt_access = False )
156
+ use_jwt .assert_not_called ()
157
+
163
158
164
159
@pytest .mark .parametrize (
165
160
"client_class" , [DataTransferServiceClient , DataTransferServiceAsyncClient ,]
@@ -244,6 +239,7 @@ def test_data_transfer_service_client_client_options(
244
239
client_cert_source_for_mtls = None ,
245
240
quota_project_id = None ,
246
241
client_info = transports .base .DEFAULT_CLIENT_INFO ,
242
+ always_use_jwt_access = True ,
247
243
)
248
244
249
245
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -260,6 +256,7 @@ def test_data_transfer_service_client_client_options(
260
256
client_cert_source_for_mtls = None ,
261
257
quota_project_id = None ,
262
258
client_info = transports .base .DEFAULT_CLIENT_INFO ,
259
+ always_use_jwt_access = True ,
263
260
)
264
261
265
262
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -276,6 +273,7 @@ def test_data_transfer_service_client_client_options(
276
273
client_cert_source_for_mtls = None ,
277
274
quota_project_id = None ,
278
275
client_info = transports .base .DEFAULT_CLIENT_INFO ,
276
+ always_use_jwt_access = True ,
279
277
)
280
278
281
279
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
@@ -304,6 +302,7 @@ def test_data_transfer_service_client_client_options(
304
302
client_cert_source_for_mtls = None ,
305
303
quota_project_id = "octopus" ,
306
304
client_info = transports .base .DEFAULT_CLIENT_INFO ,
305
+ always_use_jwt_access = True ,
307
306
)
308
307
309
308
@@ -380,6 +379,7 @@ def test_data_transfer_service_client_mtls_env_auto(
380
379
client_cert_source_for_mtls = expected_client_cert_source ,
381
380
quota_project_id = None ,
382
381
client_info = transports .base .DEFAULT_CLIENT_INFO ,
382
+ always_use_jwt_access = True ,
383
383
)
384
384
385
385
# Check the case ADC client cert is provided. Whether client cert is used depends on
@@ -413,6 +413,7 @@ def test_data_transfer_service_client_mtls_env_auto(
413
413
client_cert_source_for_mtls = expected_client_cert_source ,
414
414
quota_project_id = None ,
415
415
client_info = transports .base .DEFAULT_CLIENT_INFO ,
416
+ always_use_jwt_access = True ,
416
417
)
417
418
418
419
# Check the case client_cert_source and ADC client cert are not provided.
@@ -434,6 +435,7 @@ def test_data_transfer_service_client_mtls_env_auto(
434
435
client_cert_source_for_mtls = None ,
435
436
quota_project_id = None ,
436
437
client_info = transports .base .DEFAULT_CLIENT_INFO ,
438
+ always_use_jwt_access = True ,
437
439
)
438
440
439
441
@@ -468,6 +470,7 @@ def test_data_transfer_service_client_client_options_scopes(
468
470
client_cert_source_for_mtls = None ,
469
471
quota_project_id = None ,
470
472
client_info = transports .base .DEFAULT_CLIENT_INFO ,
473
+ always_use_jwt_access = True ,
471
474
)
472
475
473
476
@@ -502,6 +505,7 @@ def test_data_transfer_service_client_client_options_credentials_file(
502
505
client_cert_source_for_mtls = None ,
503
506
quota_project_id = None ,
504
507
client_info = transports .base .DEFAULT_CLIENT_INFO ,
508
+ always_use_jwt_access = True ,
505
509
)
506
510
507
511
@@ -521,6 +525,7 @@ def test_data_transfer_service_client_client_options_from_dict():
521
525
client_cert_source_for_mtls = None ,
522
526
quota_project_id = None ,
523
527
client_info = transports .base .DEFAULT_CLIENT_INFO ,
528
+ always_use_jwt_access = True ,
524
529
)
525
530
526
531
0 commit comments