@@ -127,26 +127,14 @@ def test_device_manager_client_from_service_account_info(client_class):
127127 assert client .transport ._host == "cloudiot.googleapis.com:443"
128128
129129
130- @pytest .mark .parametrize (
131- "client_class" , [DeviceManagerClient , DeviceManagerAsyncClient ,]
132- )
133- def test_device_manager_client_service_account_always_use_jwt (client_class ):
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- client = client_class (credentials = creds )
139- use_jwt .assert_not_called ()
140-
141-
142130@pytest .mark .parametrize (
143131 "transport_class,transport_name" ,
144132 [
145133 (transports .DeviceManagerGrpcTransport , "grpc" ),
146134 (transports .DeviceManagerGrpcAsyncIOTransport , "grpc_asyncio" ),
147135 ],
148136)
149- def test_device_manager_client_service_account_always_use_jwt_true (
137+ def test_device_manager_client_service_account_always_use_jwt (
150138 transport_class , transport_name
151139):
152140 with mock .patch .object (
@@ -156,6 +144,13 @@ def test_device_manager_client_service_account_always_use_jwt_true(
156144 transport = transport_class (credentials = creds , always_use_jwt_access = True )
157145 use_jwt .assert_called_once_with (True )
158146
147+ with mock .patch .object (
148+ service_account .Credentials , "with_always_use_jwt_access" , create = True
149+ ) as use_jwt :
150+ creds = service_account .Credentials (None , None , None )
151+ transport = transport_class (credentials = creds , always_use_jwt_access = False )
152+ use_jwt .assert_not_called ()
153+
159154
160155@pytest .mark .parametrize (
161156 "client_class" , [DeviceManagerClient , DeviceManagerAsyncClient ,]
@@ -236,6 +231,7 @@ def test_device_manager_client_client_options(
236231 client_cert_source_for_mtls = None ,
237232 quota_project_id = None ,
238233 client_info = transports .base .DEFAULT_CLIENT_INFO ,
234+ always_use_jwt_access = True ,
239235 )
240236
241237 # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -252,6 +248,7 @@ def test_device_manager_client_client_options(
252248 client_cert_source_for_mtls = None ,
253249 quota_project_id = None ,
254250 client_info = transports .base .DEFAULT_CLIENT_INFO ,
251+ always_use_jwt_access = True ,
255252 )
256253
257254 # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -268,6 +265,7 @@ def test_device_manager_client_client_options(
268265 client_cert_source_for_mtls = None ,
269266 quota_project_id = None ,
270267 client_info = transports .base .DEFAULT_CLIENT_INFO ,
268+ always_use_jwt_access = True ,
271269 )
272270
273271 # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
@@ -296,6 +294,7 @@ def test_device_manager_client_client_options(
296294 client_cert_source_for_mtls = None ,
297295 quota_project_id = "octopus" ,
298296 client_info = transports .base .DEFAULT_CLIENT_INFO ,
297+ always_use_jwt_access = True ,
299298 )
300299
301300
@@ -362,6 +361,7 @@ def test_device_manager_client_mtls_env_auto(
362361 client_cert_source_for_mtls = expected_client_cert_source ,
363362 quota_project_id = None ,
364363 client_info = transports .base .DEFAULT_CLIENT_INFO ,
364+ always_use_jwt_access = True ,
365365 )
366366
367367 # Check the case ADC client cert is provided. Whether client cert is used depends on
@@ -395,6 +395,7 @@ def test_device_manager_client_mtls_env_auto(
395395 client_cert_source_for_mtls = expected_client_cert_source ,
396396 quota_project_id = None ,
397397 client_info = transports .base .DEFAULT_CLIENT_INFO ,
398+ always_use_jwt_access = True ,
398399 )
399400
400401 # Check the case client_cert_source and ADC client cert are not provided.
@@ -416,6 +417,7 @@ def test_device_manager_client_mtls_env_auto(
416417 client_cert_source_for_mtls = None ,
417418 quota_project_id = None ,
418419 client_info = transports .base .DEFAULT_CLIENT_INFO ,
420+ always_use_jwt_access = True ,
419421 )
420422
421423
@@ -446,6 +448,7 @@ def test_device_manager_client_client_options_scopes(
446448 client_cert_source_for_mtls = None ,
447449 quota_project_id = None ,
448450 client_info = transports .base .DEFAULT_CLIENT_INFO ,
451+ always_use_jwt_access = True ,
449452 )
450453
451454
@@ -476,6 +479,7 @@ def test_device_manager_client_client_options_credentials_file(
476479 client_cert_source_for_mtls = None ,
477480 quota_project_id = None ,
478481 client_info = transports .base .DEFAULT_CLIENT_INFO ,
482+ always_use_jwt_access = True ,
479483 )
480484
481485
@@ -495,6 +499,7 @@ def test_device_manager_client_client_options_from_dict():
495499 client_cert_source_for_mtls = None ,
496500 quota_project_id = None ,
497501 client_info = transports .base .DEFAULT_CLIENT_INFO ,
502+ always_use_jwt_access = True ,
498503 )
499504
500505
0 commit comments