@@ -262,20 +262,20 @@ def test_autoscaling_policy_service_client_client_options(
262
262
# unsupported value.
263
263
with mock .patch .dict (os .environ , {"GOOGLE_API_USE_MTLS_ENDPOINT" : "Unsupported" }):
264
264
with pytest .raises (MutualTLSChannelError ):
265
- client = client_class ()
265
+ client = client_class (transport = transport_name )
266
266
267
267
# Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
268
268
with mock .patch .dict (
269
269
os .environ , {"GOOGLE_API_USE_CLIENT_CERTIFICATE" : "Unsupported" }
270
270
):
271
271
with pytest .raises (ValueError ):
272
- client = client_class ()
272
+ client = client_class (transport = transport_name )
273
273
274
274
# Check the case quota_project_id is provided
275
275
options = client_options .ClientOptions (quota_project_id = "octopus" )
276
276
with mock .patch .object (transport_class , "__init__" ) as patched :
277
277
patched .return_value = None
278
- client = client_class (transport = transport_name , client_options = options )
278
+ client = client_class (client_options = options , transport = transport_name )
279
279
patched .assert_called_once_with (
280
280
credentials = None ,
281
281
credentials_file = None ,
@@ -344,7 +344,7 @@ def test_autoscaling_policy_service_client_mtls_env_auto(
344
344
)
345
345
with mock .patch .object (transport_class , "__init__" ) as patched :
346
346
patched .return_value = None
347
- client = client_class (transport = transport_name , client_options = options )
347
+ client = client_class (client_options = options , transport = transport_name )
348
348
349
349
if use_client_cert_env == "false" :
350
350
expected_client_cert_source = None
@@ -443,7 +443,7 @@ def test_autoscaling_policy_service_client_client_options_scopes(
443
443
options = client_options .ClientOptions (scopes = ["1" , "2" ],)
444
444
with mock .patch .object (transport_class , "__init__" ) as patched :
445
445
patched .return_value = None
446
- client = client_class (transport = transport_name , client_options = options )
446
+ client = client_class (client_options = options , transport = transport_name )
447
447
patched .assert_called_once_with (
448
448
credentials = None ,
449
449
credentials_file = None ,
@@ -478,7 +478,7 @@ def test_autoscaling_policy_service_client_client_options_credentials_file(
478
478
options = client_options .ClientOptions (credentials_file = "credentials.json" )
479
479
with mock .patch .object (transport_class , "__init__" ) as patched :
480
480
patched .return_value = None
481
- client = client_class (transport = transport_name , client_options = options )
481
+ client = client_class (client_options = options , transport = transport_name )
482
482
patched .assert_called_once_with (
483
483
credentials = None ,
484
484
credentials_file = "credentials.json" ,
@@ -511,10 +511,10 @@ def test_autoscaling_policy_service_client_client_options_from_dict():
511
511
)
512
512
513
513
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" ):
518
518
client = AutoscalingPolicyServiceClient (
519
519
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
520
520
)
@@ -550,10 +550,6 @@ def test_create_autoscaling_policy(
550
550
assert response .name == "name_value"
551
551
552
552
553
- def test_create_autoscaling_policy_from_dict ():
554
- test_create_autoscaling_policy (request_type = dict )
555
-
556
-
557
553
def test_create_autoscaling_policy_empty_call ():
558
554
# This test is a coverage failsafe to make sure that totally empty calls,
559
555
# i.e. request == None and no flattened fields passed, work.
@@ -765,10 +761,10 @@ async def test_create_autoscaling_policy_flattened_error_async():
765
761
)
766
762
767
763
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" ):
772
768
client = AutoscalingPolicyServiceClient (
773
769
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
774
770
)
@@ -804,10 +800,6 @@ def test_update_autoscaling_policy(
804
800
assert response .name == "name_value"
805
801
806
802
807
- def test_update_autoscaling_policy_from_dict ():
808
- test_update_autoscaling_policy (request_type = dict )
809
-
810
-
811
803
def test_update_autoscaling_policy_empty_call ():
812
804
# This test is a coverage failsafe to make sure that totally empty calls,
813
805
# i.e. request == None and no flattened fields passed, work.
@@ -1009,10 +1001,10 @@ async def test_update_autoscaling_policy_flattened_error_async():
1009
1001
)
1010
1002
1011
1003
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" ):
1016
1008
client = AutoscalingPolicyServiceClient (
1017
1009
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
1018
1010
)
@@ -1048,10 +1040,6 @@ def test_get_autoscaling_policy(
1048
1040
assert response .name == "name_value"
1049
1041
1050
1042
1051
- def test_get_autoscaling_policy_from_dict ():
1052
- test_get_autoscaling_policy (request_type = dict )
1053
-
1054
-
1055
1043
def test_get_autoscaling_policy_empty_call ():
1056
1044
# This test is a coverage failsafe to make sure that totally empty calls,
1057
1045
# i.e. request == None and no flattened fields passed, work.
@@ -1247,10 +1235,10 @@ async def test_get_autoscaling_policy_flattened_error_async():
1247
1235
)
1248
1236
1249
1237
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" ):
1254
1242
client = AutoscalingPolicyServiceClient (
1255
1243
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
1256
1244
)
@@ -1279,10 +1267,6 @@ def test_list_autoscaling_policies(
1279
1267
assert response .next_page_token == "next_page_token_value"
1280
1268
1281
1269
1282
- def test_list_autoscaling_policies_from_dict ():
1283
- test_list_autoscaling_policies (request_type = dict )
1284
-
1285
-
1286
1270
def test_list_autoscaling_policies_empty_call ():
1287
1271
# This test is a coverage failsafe to make sure that totally empty calls,
1288
1272
# i.e. request == None and no flattened fields passed, work.
@@ -1481,9 +1465,9 @@ async def test_list_autoscaling_policies_flattened_error_async():
1481
1465
)
1482
1466
1483
1467
1484
- def test_list_autoscaling_policies_pager ():
1468
+ def test_list_autoscaling_policies_pager (transport_name : str = "grpc" ):
1485
1469
client = AutoscalingPolicyServiceClient (
1486
- credentials = ga_credentials .AnonymousCredentials ,
1470
+ credentials = ga_credentials .AnonymousCredentials , transport = transport_name ,
1487
1471
)
1488
1472
1489
1473
# Mock the actual call within the gRPC stub, and fake the request.
@@ -1531,9 +1515,9 @@ def test_list_autoscaling_policies_pager():
1531
1515
)
1532
1516
1533
1517
1534
- def test_list_autoscaling_policies_pages ():
1518
+ def test_list_autoscaling_policies_pages (transport_name : str = "grpc" ):
1535
1519
client = AutoscalingPolicyServiceClient (
1536
- credentials = ga_credentials .AnonymousCredentials ,
1520
+ credentials = ga_credentials .AnonymousCredentials , transport = transport_name ,
1537
1521
)
1538
1522
1539
1523
# Mock the actual call within the gRPC stub, and fake the request.
@@ -1663,10 +1647,10 @@ async def test_list_autoscaling_policies_async_pages():
1663
1647
assert page_ .raw_page .next_page_token == token
1664
1648
1665
1649
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" ):
1670
1654
client = AutoscalingPolicyServiceClient (
1671
1655
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
1672
1656
)
@@ -1692,10 +1676,6 @@ def test_delete_autoscaling_policy(
1692
1676
assert response is None
1693
1677
1694
1678
1695
- def test_delete_autoscaling_policy_from_dict ():
1696
- test_delete_autoscaling_policy (request_type = dict )
1697
-
1698
-
1699
1679
def test_delete_autoscaling_policy_empty_call ():
1700
1680
# This test is a coverage failsafe to make sure that totally empty calls,
1701
1681
# i.e. request == None and no flattened fields passed, work.
@@ -2411,7 +2391,7 @@ def test_parse_common_location_path():
2411
2391
assert expected == actual
2412
2392
2413
2393
2414
- def test_client_withDEFAULT_CLIENT_INFO ():
2394
+ def test_client_with_default_client_info ():
2415
2395
client_info = gapic_v1 .client_info .ClientInfo ()
2416
2396
2417
2397
with mock .patch .object (
0 commit comments