@@ -262,20 +262,20 @@ def test_autoscaling_policy_service_client_client_options(
262262 # unsupported value.
263263 with mock .patch .dict (os .environ , {"GOOGLE_API_USE_MTLS_ENDPOINT" : "Unsupported" }):
264264 with pytest .raises (MutualTLSChannelError ):
265- client = client_class ()
265+ client = client_class (transport = transport_name )
266266
267267 # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
268268 with mock .patch .dict (
269269 os .environ , {"GOOGLE_API_USE_CLIENT_CERTIFICATE" : "Unsupported" }
270270 ):
271271 with pytest .raises (ValueError ):
272- client = client_class ()
272+ client = client_class (transport = transport_name )
273273
274274 # Check the case quota_project_id is provided
275275 options = client_options .ClientOptions (quota_project_id = "octopus" )
276276 with mock .patch .object (transport_class , "__init__" ) as patched :
277277 patched .return_value = None
278- client = client_class (transport = transport_name , client_options = options )
278+ client = client_class (client_options = options , transport = transport_name )
279279 patched .assert_called_once_with (
280280 credentials = None ,
281281 credentials_file = None ,
@@ -344,7 +344,7 @@ def test_autoscaling_policy_service_client_mtls_env_auto(
344344 )
345345 with mock .patch .object (transport_class , "__init__" ) as patched :
346346 patched .return_value = None
347- client = client_class (transport = transport_name , client_options = options )
347+ client = client_class (client_options = options , transport = transport_name )
348348
349349 if use_client_cert_env == "false" :
350350 expected_client_cert_source = None
@@ -443,7 +443,7 @@ def test_autoscaling_policy_service_client_client_options_scopes(
443443 options = client_options .ClientOptions (scopes = ["1" , "2" ],)
444444 with mock .patch .object (transport_class , "__init__" ) as patched :
445445 patched .return_value = None
446- client = client_class (transport = transport_name , client_options = options )
446+ client = client_class (client_options = options , transport = transport_name )
447447 patched .assert_called_once_with (
448448 credentials = None ,
449449 credentials_file = None ,
@@ -478,7 +478,7 @@ def test_autoscaling_policy_service_client_client_options_credentials_file(
478478 options = client_options .ClientOptions (credentials_file = "credentials.json" )
479479 with mock .patch .object (transport_class , "__init__" ) as patched :
480480 patched .return_value = None
481- client = client_class (transport = transport_name , client_options = options )
481+ client = client_class (client_options = options , transport = transport_name )
482482 patched .assert_called_once_with (
483483 credentials = None ,
484484 credentials_file = "credentials.json" ,
@@ -511,10 +511,10 @@ def test_autoscaling_policy_service_client_client_options_from_dict():
511511 )
512512
513513
514- def test_create_autoscaling_policy (
515- transport : str = "grpc" ,
516- request_type = autoscaling_policies . CreateAutoscalingPolicyRequest ,
517- ):
514+ @ pytest . mark . parametrize (
515+ "request_type" , [ autoscaling_policies . CreateAutoscalingPolicyRequest , dict ,]
516+ )
517+ def test_create_autoscaling_policy ( request_type , transport : str = "grpc" ):
518518 client = AutoscalingPolicyServiceClient (
519519 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
520520 )
@@ -550,10 +550,6 @@ def test_create_autoscaling_policy(
550550 assert response .name == "name_value"
551551
552552
553- def test_create_autoscaling_policy_from_dict ():
554- test_create_autoscaling_policy (request_type = dict )
555-
556-
557553def test_create_autoscaling_policy_empty_call ():
558554 # This test is a coverage failsafe to make sure that totally empty calls,
559555 # i.e. request == None and no flattened fields passed, work.
@@ -765,10 +761,10 @@ async def test_create_autoscaling_policy_flattened_error_async():
765761 )
766762
767763
768- def test_update_autoscaling_policy (
769- transport : str = "grpc" ,
770- request_type = autoscaling_policies . UpdateAutoscalingPolicyRequest ,
771- ):
764+ @ pytest . mark . parametrize (
765+ "request_type" , [ autoscaling_policies . UpdateAutoscalingPolicyRequest , dict ,]
766+ )
767+ def test_update_autoscaling_policy ( request_type , transport : str = "grpc" ):
772768 client = AutoscalingPolicyServiceClient (
773769 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
774770 )
@@ -804,10 +800,6 @@ def test_update_autoscaling_policy(
804800 assert response .name == "name_value"
805801
806802
807- def test_update_autoscaling_policy_from_dict ():
808- test_update_autoscaling_policy (request_type = dict )
809-
810-
811803def test_update_autoscaling_policy_empty_call ():
812804 # This test is a coverage failsafe to make sure that totally empty calls,
813805 # i.e. request == None and no flattened fields passed, work.
@@ -1009,10 +1001,10 @@ async def test_update_autoscaling_policy_flattened_error_async():
10091001 )
10101002
10111003
1012- def test_get_autoscaling_policy (
1013- transport : str = "grpc" ,
1014- request_type = autoscaling_policies . GetAutoscalingPolicyRequest ,
1015- ):
1004+ @ pytest . mark . parametrize (
1005+ "request_type" , [ autoscaling_policies . GetAutoscalingPolicyRequest , dict ,]
1006+ )
1007+ def test_get_autoscaling_policy ( request_type , transport : str = "grpc" ):
10161008 client = AutoscalingPolicyServiceClient (
10171009 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
10181010 )
@@ -1048,10 +1040,6 @@ def test_get_autoscaling_policy(
10481040 assert response .name == "name_value"
10491041
10501042
1051- def test_get_autoscaling_policy_from_dict ():
1052- test_get_autoscaling_policy (request_type = dict )
1053-
1054-
10551043def test_get_autoscaling_policy_empty_call ():
10561044 # This test is a coverage failsafe to make sure that totally empty calls,
10571045 # i.e. request == None and no flattened fields passed, work.
@@ -1247,10 +1235,10 @@ async def test_get_autoscaling_policy_flattened_error_async():
12471235 )
12481236
12491237
1250- def test_list_autoscaling_policies (
1251- transport : str = "grpc" ,
1252- request_type = autoscaling_policies . ListAutoscalingPoliciesRequest ,
1253- ):
1238+ @ pytest . mark . parametrize (
1239+ "request_type" , [ autoscaling_policies . ListAutoscalingPoliciesRequest , dict ,]
1240+ )
1241+ def test_list_autoscaling_policies ( request_type , transport : str = "grpc" ):
12541242 client = AutoscalingPolicyServiceClient (
12551243 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
12561244 )
@@ -1279,10 +1267,6 @@ def test_list_autoscaling_policies(
12791267 assert response .next_page_token == "next_page_token_value"
12801268
12811269
1282- def test_list_autoscaling_policies_from_dict ():
1283- test_list_autoscaling_policies (request_type = dict )
1284-
1285-
12861270def test_list_autoscaling_policies_empty_call ():
12871271 # This test is a coverage failsafe to make sure that totally empty calls,
12881272 # i.e. request == None and no flattened fields passed, work.
@@ -1481,9 +1465,9 @@ async def test_list_autoscaling_policies_flattened_error_async():
14811465 )
14821466
14831467
1484- def test_list_autoscaling_policies_pager ():
1468+ def test_list_autoscaling_policies_pager (transport_name : str = "grpc" ):
14851469 client = AutoscalingPolicyServiceClient (
1486- credentials = ga_credentials .AnonymousCredentials ,
1470+ credentials = ga_credentials .AnonymousCredentials , transport = transport_name ,
14871471 )
14881472
14891473 # Mock the actual call within the gRPC stub, and fake the request.
@@ -1531,9 +1515,9 @@ def test_list_autoscaling_policies_pager():
15311515 )
15321516
15331517
1534- def test_list_autoscaling_policies_pages ():
1518+ def test_list_autoscaling_policies_pages (transport_name : str = "grpc" ):
15351519 client = AutoscalingPolicyServiceClient (
1536- credentials = ga_credentials .AnonymousCredentials ,
1520+ credentials = ga_credentials .AnonymousCredentials , transport = transport_name ,
15371521 )
15381522
15391523 # Mock the actual call within the gRPC stub, and fake the request.
@@ -1663,10 +1647,10 @@ async def test_list_autoscaling_policies_async_pages():
16631647 assert page_ .raw_page .next_page_token == token
16641648
16651649
1666- def test_delete_autoscaling_policy (
1667- transport : str = "grpc" ,
1668- request_type = autoscaling_policies . DeleteAutoscalingPolicyRequest ,
1669- ):
1650+ @ pytest . mark . parametrize (
1651+ "request_type" , [ autoscaling_policies . DeleteAutoscalingPolicyRequest , dict ,]
1652+ )
1653+ def test_delete_autoscaling_policy ( request_type , transport : str = "grpc" ):
16701654 client = AutoscalingPolicyServiceClient (
16711655 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
16721656 )
@@ -1692,10 +1676,6 @@ def test_delete_autoscaling_policy(
16921676 assert response is None
16931677
16941678
1695- def test_delete_autoscaling_policy_from_dict ():
1696- test_delete_autoscaling_policy (request_type = dict )
1697-
1698-
16991679def test_delete_autoscaling_policy_empty_call ():
17001680 # This test is a coverage failsafe to make sure that totally empty calls,
17011681 # i.e. request == None and no flattened fields passed, work.
@@ -2411,7 +2391,7 @@ def test_parse_common_location_path():
24112391 assert expected == actual
24122392
24132393
2414- def test_client_withDEFAULT_CLIENT_INFO ():
2394+ def test_client_with_default_client_info ():
24152395 client_info = gapic_v1 .client_info .ClientInfo ()
24162396
24172397 with mock .patch .object (
0 commit comments