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