@@ -114,24 +114,14 @@ def test_org_policy_client_from_service_account_info(client_class):
114
114
assert client .transport ._host == "orgpolicy.googleapis.com:443"
115
115
116
116
117
- @pytest .mark .parametrize ("client_class" , [OrgPolicyClient , OrgPolicyAsyncClient ,])
118
- def test_org_policy_client_service_account_always_use_jwt (client_class ):
119
- with mock .patch .object (
120
- service_account .Credentials , "with_always_use_jwt_access" , create = True
121
- ) as use_jwt :
122
- creds = service_account .Credentials (None , None , None )
123
- client = client_class (credentials = creds )
124
- use_jwt .assert_not_called ()
125
-
126
-
127
117
@pytest .mark .parametrize (
128
118
"transport_class,transport_name" ,
129
119
[
130
120
(transports .OrgPolicyGrpcTransport , "grpc" ),
131
121
(transports .OrgPolicyGrpcAsyncIOTransport , "grpc_asyncio" ),
132
122
],
133
123
)
134
- def test_org_policy_client_service_account_always_use_jwt_true (
124
+ def test_org_policy_client_service_account_always_use_jwt (
135
125
transport_class , transport_name
136
126
):
137
127
with mock .patch .object (
@@ -141,6 +131,13 @@ def test_org_policy_client_service_account_always_use_jwt_true(
141
131
transport = transport_class (credentials = creds , always_use_jwt_access = True )
142
132
use_jwt .assert_called_once_with (True )
143
133
134
+ with mock .patch .object (
135
+ service_account .Credentials , "with_always_use_jwt_access" , create = True
136
+ ) as use_jwt :
137
+ creds = service_account .Credentials (None , None , None )
138
+ transport = transport_class (credentials = creds , always_use_jwt_access = False )
139
+ use_jwt .assert_not_called ()
140
+
144
141
145
142
@pytest .mark .parametrize ("client_class" , [OrgPolicyClient , OrgPolicyAsyncClient ,])
146
143
def test_org_policy_client_from_service_account_file (client_class ):
@@ -217,6 +214,7 @@ def test_org_policy_client_client_options(
217
214
client_cert_source_for_mtls = None ,
218
215
quota_project_id = None ,
219
216
client_info = transports .base .DEFAULT_CLIENT_INFO ,
217
+ always_use_jwt_access = True ,
220
218
)
221
219
222
220
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -233,6 +231,7 @@ def test_org_policy_client_client_options(
233
231
client_cert_source_for_mtls = None ,
234
232
quota_project_id = None ,
235
233
client_info = transports .base .DEFAULT_CLIENT_INFO ,
234
+ always_use_jwt_access = True ,
236
235
)
237
236
238
237
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -249,6 +248,7 @@ def test_org_policy_client_client_options(
249
248
client_cert_source_for_mtls = None ,
250
249
quota_project_id = None ,
251
250
client_info = transports .base .DEFAULT_CLIENT_INFO ,
251
+ always_use_jwt_access = True ,
252
252
)
253
253
254
254
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
@@ -277,6 +277,7 @@ def test_org_policy_client_client_options(
277
277
client_cert_source_for_mtls = None ,
278
278
quota_project_id = "octopus" ,
279
279
client_info = transports .base .DEFAULT_CLIENT_INFO ,
280
+ always_use_jwt_access = True ,
280
281
)
281
282
282
283
@@ -341,6 +342,7 @@ def test_org_policy_client_mtls_env_auto(
341
342
client_cert_source_for_mtls = expected_client_cert_source ,
342
343
quota_project_id = None ,
343
344
client_info = transports .base .DEFAULT_CLIENT_INFO ,
345
+ always_use_jwt_access = True ,
344
346
)
345
347
346
348
# Check the case ADC client cert is provided. Whether client cert is used depends on
@@ -374,6 +376,7 @@ def test_org_policy_client_mtls_env_auto(
374
376
client_cert_source_for_mtls = expected_client_cert_source ,
375
377
quota_project_id = None ,
376
378
client_info = transports .base .DEFAULT_CLIENT_INFO ,
379
+ always_use_jwt_access = True ,
377
380
)
378
381
379
382
# Check the case client_cert_source and ADC client cert are not provided.
@@ -395,6 +398,7 @@ def test_org_policy_client_mtls_env_auto(
395
398
client_cert_source_for_mtls = None ,
396
399
quota_project_id = None ,
397
400
client_info = transports .base .DEFAULT_CLIENT_INFO ,
401
+ always_use_jwt_access = True ,
398
402
)
399
403
400
404
@@ -425,6 +429,7 @@ def test_org_policy_client_client_options_scopes(
425
429
client_cert_source_for_mtls = None ,
426
430
quota_project_id = None ,
427
431
client_info = transports .base .DEFAULT_CLIENT_INFO ,
432
+ always_use_jwt_access = True ,
428
433
)
429
434
430
435
@@ -455,6 +460,7 @@ def test_org_policy_client_client_options_credentials_file(
455
460
client_cert_source_for_mtls = None ,
456
461
quota_project_id = None ,
457
462
client_info = transports .base .DEFAULT_CLIENT_INFO ,
463
+ always_use_jwt_access = True ,
458
464
)
459
465
460
466
@@ -472,6 +478,7 @@ def test_org_policy_client_client_options_from_dict():
472
478
client_cert_source_for_mtls = None ,
473
479
quota_project_id = None ,
474
480
client_info = transports .base .DEFAULT_CLIENT_INFO ,
481
+ always_use_jwt_access = True ,
475
482
)
476
483
477
484
0 commit comments