@@ -133,26 +133,14 @@ def test_dashboards_service_client_from_service_account_info(client_class):
133
133
assert client .transport ._host == "monitoring.googleapis.com:443"
134
134
135
135
136
- @pytest .mark .parametrize (
137
- "client_class" , [DashboardsServiceClient , DashboardsServiceAsyncClient ,]
138
- )
139
- def test_dashboards_service_client_service_account_always_use_jwt (client_class ):
140
- with mock .patch .object (
141
- service_account .Credentials , "with_always_use_jwt_access" , create = True
142
- ) as use_jwt :
143
- creds = service_account .Credentials (None , None , None )
144
- client = client_class (credentials = creds )
145
- use_jwt .assert_not_called ()
146
-
147
-
148
136
@pytest .mark .parametrize (
149
137
"transport_class,transport_name" ,
150
138
[
151
139
(transports .DashboardsServiceGrpcTransport , "grpc" ),
152
140
(transports .DashboardsServiceGrpcAsyncIOTransport , "grpc_asyncio" ),
153
141
],
154
142
)
155
- def test_dashboards_service_client_service_account_always_use_jwt_true (
143
+ def test_dashboards_service_client_service_account_always_use_jwt (
156
144
transport_class , transport_name
157
145
):
158
146
with mock .patch .object (
@@ -162,6 +150,13 @@ def test_dashboards_service_client_service_account_always_use_jwt_true(
162
150
transport = transport_class (credentials = creds , always_use_jwt_access = True )
163
151
use_jwt .assert_called_once_with (True )
164
152
153
+ with mock .patch .object (
154
+ service_account .Credentials , "with_always_use_jwt_access" , create = True
155
+ ) as use_jwt :
156
+ creds = service_account .Credentials (None , None , None )
157
+ transport = transport_class (credentials = creds , always_use_jwt_access = False )
158
+ use_jwt .assert_not_called ()
159
+
165
160
166
161
@pytest .mark .parametrize (
167
162
"client_class" , [DashboardsServiceClient , DashboardsServiceAsyncClient ,]
@@ -242,6 +237,7 @@ def test_dashboards_service_client_client_options(
242
237
client_cert_source_for_mtls = None ,
243
238
quota_project_id = None ,
244
239
client_info = transports .base .DEFAULT_CLIENT_INFO ,
240
+ always_use_jwt_access = True ,
245
241
)
246
242
247
243
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -258,6 +254,7 @@ def test_dashboards_service_client_client_options(
258
254
client_cert_source_for_mtls = None ,
259
255
quota_project_id = None ,
260
256
client_info = transports .base .DEFAULT_CLIENT_INFO ,
257
+ always_use_jwt_access = True ,
261
258
)
262
259
263
260
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -274,6 +271,7 @@ def test_dashboards_service_client_client_options(
274
271
client_cert_source_for_mtls = None ,
275
272
quota_project_id = None ,
276
273
client_info = transports .base .DEFAULT_CLIENT_INFO ,
274
+ always_use_jwt_access = True ,
277
275
)
278
276
279
277
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
@@ -302,6 +300,7 @@ def test_dashboards_service_client_client_options(
302
300
client_cert_source_for_mtls = None ,
303
301
quota_project_id = "octopus" ,
304
302
client_info = transports .base .DEFAULT_CLIENT_INFO ,
303
+ always_use_jwt_access = True ,
305
304
)
306
305
307
306
@@ -378,6 +377,7 @@ def test_dashboards_service_client_mtls_env_auto(
378
377
client_cert_source_for_mtls = expected_client_cert_source ,
379
378
quota_project_id = None ,
380
379
client_info = transports .base .DEFAULT_CLIENT_INFO ,
380
+ always_use_jwt_access = True ,
381
381
)
382
382
383
383
# Check the case ADC client cert is provided. Whether client cert is used depends on
@@ -411,6 +411,7 @@ def test_dashboards_service_client_mtls_env_auto(
411
411
client_cert_source_for_mtls = expected_client_cert_source ,
412
412
quota_project_id = None ,
413
413
client_info = transports .base .DEFAULT_CLIENT_INFO ,
414
+ always_use_jwt_access = True ,
414
415
)
415
416
416
417
# Check the case client_cert_source and ADC client cert are not provided.
@@ -432,6 +433,7 @@ def test_dashboards_service_client_mtls_env_auto(
432
433
client_cert_source_for_mtls = None ,
433
434
quota_project_id = None ,
434
435
client_info = transports .base .DEFAULT_CLIENT_INFO ,
436
+ always_use_jwt_access = True ,
435
437
)
436
438
437
439
@@ -462,6 +464,7 @@ def test_dashboards_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
@@ -492,6 +495,7 @@ def test_dashboards_service_client_client_options_credentials_file(
492
495
client_cert_source_for_mtls = None ,
493
496
quota_project_id = None ,
494
497
client_info = transports .base .DEFAULT_CLIENT_INFO ,
498
+ always_use_jwt_access = True ,
495
499
)
496
500
497
501
@@ -511,6 +515,7 @@ def test_dashboards_service_client_client_options_from_dict():
511
515
client_cert_source_for_mtls = None ,
512
516
quota_project_id = None ,
513
517
client_info = transports .base .DEFAULT_CLIENT_INFO ,
518
+ always_use_jwt_access = True ,
514
519
)
515
520
516
521
0 commit comments