@@ -124,26 +124,14 @@ def test_image_annotator_client_from_service_account_info(client_class):
124124 assert client .transport ._host == "vision.googleapis.com:443"
125125
126126
127- @pytest .mark .parametrize (
128- "client_class" , [ImageAnnotatorClient , ImageAnnotatorAsyncClient ,]
129- )
130- def test_image_annotator_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-
139127@pytest .mark .parametrize (
140128 "transport_class,transport_name" ,
141129 [
142130 (transports .ImageAnnotatorGrpcTransport , "grpc" ),
143131 (transports .ImageAnnotatorGrpcAsyncIOTransport , "grpc_asyncio" ),
144132 ],
145133)
146- def test_image_annotator_client_service_account_always_use_jwt_true (
134+ def test_image_annotator_client_service_account_always_use_jwt (
147135 transport_class , transport_name
148136):
149137 with mock .patch .object (
@@ -153,6 +141,13 @@ def test_image_annotator_client_service_account_always_use_jwt_true(
153141 transport = transport_class (credentials = creds , always_use_jwt_access = True )
154142 use_jwt .assert_called_once_with (True )
155143
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+
156151
157152@pytest .mark .parametrize (
158153 "client_class" , [ImageAnnotatorClient , ImageAnnotatorAsyncClient ,]
@@ -233,6 +228,7 @@ def test_image_annotator_client_client_options(
233228 client_cert_source_for_mtls = None ,
234229 quota_project_id = None ,
235230 client_info = transports .base .DEFAULT_CLIENT_INFO ,
231+ always_use_jwt_access = True ,
236232 )
237233
238234 # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -249,6 +245,7 @@ def test_image_annotator_client_client_options(
249245 client_cert_source_for_mtls = None ,
250246 quota_project_id = None ,
251247 client_info = transports .base .DEFAULT_CLIENT_INFO ,
248+ always_use_jwt_access = True ,
252249 )
253250
254251 # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -265,6 +262,7 @@ def test_image_annotator_client_client_options(
265262 client_cert_source_for_mtls = None ,
266263 quota_project_id = None ,
267264 client_info = transports .base .DEFAULT_CLIENT_INFO ,
265+ always_use_jwt_access = True ,
268266 )
269267
270268 # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
@@ -293,6 +291,7 @@ def test_image_annotator_client_client_options(
293291 client_cert_source_for_mtls = None ,
294292 quota_project_id = "octopus" ,
295293 client_info = transports .base .DEFAULT_CLIENT_INFO ,
294+ always_use_jwt_access = True ,
296295 )
297296
298297
@@ -359,6 +358,7 @@ def test_image_annotator_client_mtls_env_auto(
359358 client_cert_source_for_mtls = expected_client_cert_source ,
360359 quota_project_id = None ,
361360 client_info = transports .base .DEFAULT_CLIENT_INFO ,
361+ always_use_jwt_access = True ,
362362 )
363363
364364 # Check the case ADC client cert is provided. Whether client cert is used depends on
@@ -392,6 +392,7 @@ def test_image_annotator_client_mtls_env_auto(
392392 client_cert_source_for_mtls = expected_client_cert_source ,
393393 quota_project_id = None ,
394394 client_info = transports .base .DEFAULT_CLIENT_INFO ,
395+ always_use_jwt_access = True ,
395396 )
396397
397398 # Check the case client_cert_source and ADC client cert are not provided.
@@ -413,6 +414,7 @@ def test_image_annotator_client_mtls_env_auto(
413414 client_cert_source_for_mtls = None ,
414415 quota_project_id = None ,
415416 client_info = transports .base .DEFAULT_CLIENT_INFO ,
417+ always_use_jwt_access = True ,
416418 )
417419
418420
@@ -443,6 +445,7 @@ def test_image_annotator_client_client_options_scopes(
443445 client_cert_source_for_mtls = None ,
444446 quota_project_id = None ,
445447 client_info = transports .base .DEFAULT_CLIENT_INFO ,
448+ always_use_jwt_access = True ,
446449 )
447450
448451
@@ -473,6 +476,7 @@ def test_image_annotator_client_client_options_credentials_file(
473476 client_cert_source_for_mtls = None ,
474477 quota_project_id = None ,
475478 client_info = transports .base .DEFAULT_CLIENT_INFO ,
479+ always_use_jwt_access = True ,
476480 )
477481
478482
@@ -492,6 +496,7 @@ def test_image_annotator_client_client_options_from_dict():
492496 client_cert_source_for_mtls = None ,
493497 quota_project_id = None ,
494498 client_info = transports .base .DEFAULT_CLIENT_INFO ,
499+ always_use_jwt_access = True ,
495500 )
496501
497502
0 commit comments