@@ -124,26 +124,14 @@ def test_flex_templates_service_client_from_service_account_info(client_class):
124
124
assert client .transport ._host == "dataflow.googleapis.com:443"
125
125
126
126
127
- @pytest .mark .parametrize (
128
- "client_class" , [FlexTemplatesServiceClient , FlexTemplatesServiceAsyncClient ,]
129
- )
130
- def test_flex_templates_service_client_service_account_always_use_jwt (client_class ):
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
- client = client_class (credentials = creds )
136
- use_jwt .assert_not_called ()
137
-
138
-
139
127
@pytest .mark .parametrize (
140
128
"transport_class,transport_name" ,
141
129
[
142
130
(transports .FlexTemplatesServiceGrpcTransport , "grpc" ),
143
131
(transports .FlexTemplatesServiceGrpcAsyncIOTransport , "grpc_asyncio" ),
144
132
],
145
133
)
146
- def test_flex_templates_service_client_service_account_always_use_jwt_true (
134
+ def test_flex_templates_service_client_service_account_always_use_jwt (
147
135
transport_class , transport_name
148
136
):
149
137
with mock .patch .object (
@@ -153,6 +141,13 @@ def test_flex_templates_service_client_service_account_always_use_jwt_true(
153
141
transport = transport_class (credentials = creds , always_use_jwt_access = True )
154
142
use_jwt .assert_called_once_with (True )
155
143
144
+ with mock .patch .object (
145
+ service_account .Credentials , "with_always_use_jwt_access" , create = True
146
+ ) as use_jwt :
147
+ creds = service_account .Credentials (None , None , None )
148
+ transport = transport_class (credentials = creds , always_use_jwt_access = False )
149
+ use_jwt .assert_not_called ()
150
+
156
151
157
152
@pytest .mark .parametrize (
158
153
"client_class" , [FlexTemplatesServiceClient , FlexTemplatesServiceAsyncClient ,]
@@ -237,6 +232,7 @@ def test_flex_templates_service_client_client_options(
237
232
client_cert_source_for_mtls = None ,
238
233
quota_project_id = None ,
239
234
client_info = transports .base .DEFAULT_CLIENT_INFO ,
235
+ always_use_jwt_access = True ,
240
236
)
241
237
242
238
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -253,6 +249,7 @@ def test_flex_templates_service_client_client_options(
253
249
client_cert_source_for_mtls = None ,
254
250
quota_project_id = None ,
255
251
client_info = transports .base .DEFAULT_CLIENT_INFO ,
252
+ always_use_jwt_access = True ,
256
253
)
257
254
258
255
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -269,6 +266,7 @@ def test_flex_templates_service_client_client_options(
269
266
client_cert_source_for_mtls = None ,
270
267
quota_project_id = None ,
271
268
client_info = transports .base .DEFAULT_CLIENT_INFO ,
269
+ always_use_jwt_access = True ,
272
270
)
273
271
274
272
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
@@ -297,6 +295,7 @@ def test_flex_templates_service_client_client_options(
297
295
client_cert_source_for_mtls = None ,
298
296
quota_project_id = "octopus" ,
299
297
client_info = transports .base .DEFAULT_CLIENT_INFO ,
298
+ always_use_jwt_access = True ,
300
299
)
301
300
302
301
@@ -373,6 +372,7 @@ def test_flex_templates_service_client_mtls_env_auto(
373
372
client_cert_source_for_mtls = expected_client_cert_source ,
374
373
quota_project_id = None ,
375
374
client_info = transports .base .DEFAULT_CLIENT_INFO ,
375
+ always_use_jwt_access = True ,
376
376
)
377
377
378
378
# Check the case ADC client cert is provided. Whether client cert is used depends on
@@ -406,6 +406,7 @@ def test_flex_templates_service_client_mtls_env_auto(
406
406
client_cert_source_for_mtls = expected_client_cert_source ,
407
407
quota_project_id = None ,
408
408
client_info = transports .base .DEFAULT_CLIENT_INFO ,
409
+ always_use_jwt_access = True ,
409
410
)
410
411
411
412
# Check the case client_cert_source and ADC client cert are not provided.
@@ -427,6 +428,7 @@ def test_flex_templates_service_client_mtls_env_auto(
427
428
client_cert_source_for_mtls = None ,
428
429
quota_project_id = None ,
429
430
client_info = transports .base .DEFAULT_CLIENT_INFO ,
431
+ always_use_jwt_access = True ,
430
432
)
431
433
432
434
@@ -461,6 +463,7 @@ def test_flex_templates_service_client_client_options_scopes(
461
463
client_cert_source_for_mtls = None ,
462
464
quota_project_id = None ,
463
465
client_info = transports .base .DEFAULT_CLIENT_INFO ,
466
+ always_use_jwt_access = True ,
464
467
)
465
468
466
469
@@ -495,6 +498,7 @@ def test_flex_templates_service_client_client_options_credentials_file(
495
498
client_cert_source_for_mtls = None ,
496
499
quota_project_id = None ,
497
500
client_info = transports .base .DEFAULT_CLIENT_INFO ,
501
+ always_use_jwt_access = True ,
498
502
)
499
503
500
504
@@ -514,6 +518,7 @@ def test_flex_templates_service_client_client_options_from_dict():
514
518
client_cert_source_for_mtls = None ,
515
519
quota_project_id = None ,
516
520
client_info = transports .base .DEFAULT_CLIENT_INFO ,
521
+ always_use_jwt_access = True ,
517
522
)
518
523
519
524
0 commit comments