@@ -125,26 +125,14 @@ def test_resource_settings_service_client_from_service_account_info(client_class
125
125
assert client .transport ._host == "resourcesettings.googleapis.com:443"
126
126
127
127
128
- @pytest .mark .parametrize (
129
- "client_class" , [ResourceSettingsServiceClient , ResourceSettingsServiceAsyncClient ,]
130
- )
131
- def test_resource_settings_service_client_service_account_always_use_jwt (client_class ):
132
- with mock .patch .object (
133
- service_account .Credentials , "with_always_use_jwt_access" , create = True
134
- ) as use_jwt :
135
- creds = service_account .Credentials (None , None , None )
136
- client = client_class (credentials = creds )
137
- use_jwt .assert_not_called ()
138
-
139
-
140
128
@pytest .mark .parametrize (
141
129
"transport_class,transport_name" ,
142
130
[
143
131
(transports .ResourceSettingsServiceGrpcTransport , "grpc" ),
144
132
(transports .ResourceSettingsServiceGrpcAsyncIOTransport , "grpc_asyncio" ),
145
133
],
146
134
)
147
- def test_resource_settings_service_client_service_account_always_use_jwt_true (
135
+ def test_resource_settings_service_client_service_account_always_use_jwt (
148
136
transport_class , transport_name
149
137
):
150
138
with mock .patch .object (
@@ -154,6 +142,13 @@ def test_resource_settings_service_client_service_account_always_use_jwt_true(
154
142
transport = transport_class (credentials = creds , always_use_jwt_access = True )
155
143
use_jwt .assert_called_once_with (True )
156
144
145
+ with mock .patch .object (
146
+ service_account .Credentials , "with_always_use_jwt_access" , create = True
147
+ ) as use_jwt :
148
+ creds = service_account .Credentials (None , None , None )
149
+ transport = transport_class (credentials = creds , always_use_jwt_access = False )
150
+ use_jwt .assert_not_called ()
151
+
157
152
158
153
@pytest .mark .parametrize (
159
154
"client_class" , [ResourceSettingsServiceClient , ResourceSettingsServiceAsyncClient ,]
@@ -238,6 +233,7 @@ def test_resource_settings_service_client_client_options(
238
233
client_cert_source_for_mtls = None ,
239
234
quota_project_id = None ,
240
235
client_info = transports .base .DEFAULT_CLIENT_INFO ,
236
+ always_use_jwt_access = True ,
241
237
)
242
238
243
239
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -254,6 +250,7 @@ def test_resource_settings_service_client_client_options(
254
250
client_cert_source_for_mtls = None ,
255
251
quota_project_id = None ,
256
252
client_info = transports .base .DEFAULT_CLIENT_INFO ,
253
+ always_use_jwt_access = True ,
257
254
)
258
255
259
256
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -270,6 +267,7 @@ def test_resource_settings_service_client_client_options(
270
267
client_cert_source_for_mtls = None ,
271
268
quota_project_id = None ,
272
269
client_info = transports .base .DEFAULT_CLIENT_INFO ,
270
+ always_use_jwt_access = True ,
273
271
)
274
272
275
273
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
@@ -298,6 +296,7 @@ def test_resource_settings_service_client_client_options(
298
296
client_cert_source_for_mtls = None ,
299
297
quota_project_id = "octopus" ,
300
298
client_info = transports .base .DEFAULT_CLIENT_INFO ,
299
+ always_use_jwt_access = True ,
301
300
)
302
301
303
302
@@ -374,6 +373,7 @@ def test_resource_settings_service_client_mtls_env_auto(
374
373
client_cert_source_for_mtls = expected_client_cert_source ,
375
374
quota_project_id = None ,
376
375
client_info = transports .base .DEFAULT_CLIENT_INFO ,
376
+ always_use_jwt_access = True ,
377
377
)
378
378
379
379
# Check the case ADC client cert is provided. Whether client cert is used depends on
@@ -407,6 +407,7 @@ def test_resource_settings_service_client_mtls_env_auto(
407
407
client_cert_source_for_mtls = expected_client_cert_source ,
408
408
quota_project_id = None ,
409
409
client_info = transports .base .DEFAULT_CLIENT_INFO ,
410
+ always_use_jwt_access = True ,
410
411
)
411
412
412
413
# Check the case client_cert_source and ADC client cert are not provided.
@@ -428,6 +429,7 @@ def test_resource_settings_service_client_mtls_env_auto(
428
429
client_cert_source_for_mtls = None ,
429
430
quota_project_id = None ,
430
431
client_info = transports .base .DEFAULT_CLIENT_INFO ,
432
+ always_use_jwt_access = True ,
431
433
)
432
434
433
435
@@ -462,6 +464,7 @@ def test_resource_settings_service_client_client_options_scopes(
462
464
client_cert_source_for_mtls = None ,
463
465
quota_project_id = None ,
464
466
client_info = transports .base .DEFAULT_CLIENT_INFO ,
467
+ always_use_jwt_access = True ,
465
468
)
466
469
467
470
@@ -496,6 +499,7 @@ def test_resource_settings_service_client_client_options_credentials_file(
496
499
client_cert_source_for_mtls = None ,
497
500
quota_project_id = None ,
498
501
client_info = transports .base .DEFAULT_CLIENT_INFO ,
502
+ always_use_jwt_access = True ,
499
503
)
500
504
501
505
@@ -515,6 +519,7 @@ def test_resource_settings_service_client_client_options_from_dict():
515
519
client_cert_source_for_mtls = None ,
516
520
quota_project_id = None ,
517
521
client_info = transports .base .DEFAULT_CLIENT_INFO ,
522
+ always_use_jwt_access = True ,
518
523
)
519
524
520
525
0 commit comments