@@ -243,20 +243,20 @@ def test_cloud_redis_client_client_options(
243
243
# unsupported value.
244
244
with mock .patch .dict (os .environ , {"GOOGLE_API_USE_MTLS_ENDPOINT" : "Unsupported" }):
245
245
with pytest .raises (MutualTLSChannelError ):
246
- client = client_class ()
246
+ client = client_class (transport = transport_name )
247
247
248
248
# Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
249
249
with mock .patch .dict (
250
250
os .environ , {"GOOGLE_API_USE_CLIENT_CERTIFICATE" : "Unsupported" }
251
251
):
252
252
with pytest .raises (ValueError ):
253
- client = client_class ()
253
+ client = client_class (transport = transport_name )
254
254
255
255
# Check the case quota_project_id is provided
256
256
options = client_options .ClientOptions (quota_project_id = "octopus" )
257
257
with mock .patch .object (transport_class , "__init__" ) as patched :
258
258
patched .return_value = None
259
- client = client_class (transport = transport_name , client_options = options )
259
+ client = client_class (client_options = options , transport = transport_name )
260
260
patched .assert_called_once_with (
261
261
credentials = None ,
262
262
credentials_file = None ,
@@ -313,7 +313,7 @@ def test_cloud_redis_client_mtls_env_auto(
313
313
)
314
314
with mock .patch .object (transport_class , "__init__" ) as patched :
315
315
patched .return_value = None
316
- client = client_class (transport = transport_name , client_options = options )
316
+ client = client_class (client_options = options , transport = transport_name )
317
317
318
318
if use_client_cert_env == "false" :
319
319
expected_client_cert_source = None
@@ -408,7 +408,7 @@ def test_cloud_redis_client_client_options_scopes(
408
408
options = client_options .ClientOptions (scopes = ["1" , "2" ],)
409
409
with mock .patch .object (transport_class , "__init__" ) as patched :
410
410
patched .return_value = None
411
- client = client_class (transport = transport_name , client_options = options )
411
+ client = client_class (client_options = options , transport = transport_name )
412
412
patched .assert_called_once_with (
413
413
credentials = None ,
414
414
credentials_file = None ,
@@ -439,7 +439,7 @@ def test_cloud_redis_client_client_options_credentials_file(
439
439
options = client_options .ClientOptions (credentials_file = "credentials.json" )
440
440
with mock .patch .object (transport_class , "__init__" ) as patched :
441
441
patched .return_value = None
442
- client = client_class (transport = transport_name , client_options = options )
442
+ client = client_class (client_options = options , transport = transport_name )
443
443
patched .assert_called_once_with (
444
444
credentials = None ,
445
445
credentials_file = "credentials.json" ,
@@ -470,9 +470,8 @@ def test_cloud_redis_client_client_options_from_dict():
470
470
)
471
471
472
472
473
- def test_list_instances (
474
- transport : str = "grpc" , request_type = cloud_redis .ListInstancesRequest
475
- ):
473
+ @pytest .mark .parametrize ("request_type" , [cloud_redis .ListInstancesRequest , dict ,])
474
+ def test_list_instances (request_type , transport : str = "grpc" ):
476
475
client = CloudRedisClient (
477
476
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
478
477
)
@@ -500,10 +499,6 @@ def test_list_instances(
500
499
assert response .unreachable == ["unreachable_value" ]
501
500
502
501
503
- def test_list_instances_from_dict ():
504
- test_list_instances (request_type = dict )
505
-
506
-
507
502
def test_list_instances_empty_call ():
508
503
# This test is a coverage failsafe to make sure that totally empty calls,
509
504
# i.e. request == None and no flattened fields passed, work.
@@ -677,8 +672,10 @@ async def test_list_instances_flattened_error_async():
677
672
)
678
673
679
674
680
- def test_list_instances_pager ():
681
- client = CloudRedisClient (credentials = ga_credentials .AnonymousCredentials ,)
675
+ def test_list_instances_pager (transport_name : str = "grpc" ):
676
+ client = CloudRedisClient (
677
+ credentials = ga_credentials .AnonymousCredentials , transport = transport_name ,
678
+ )
682
679
683
680
# Mock the actual call within the gRPC stub, and fake the request.
684
681
with mock .patch .object (type (client .transport .list_instances ), "__call__" ) as call :
@@ -715,8 +712,10 @@ def test_list_instances_pager():
715
712
assert all (isinstance (i , cloud_redis .Instance ) for i in results )
716
713
717
714
718
- def test_list_instances_pages ():
719
- client = CloudRedisClient (credentials = ga_credentials .AnonymousCredentials ,)
715
+ def test_list_instances_pages (transport_name : str = "grpc" ):
716
+ client = CloudRedisClient (
717
+ credentials = ga_credentials .AnonymousCredentials , transport = transport_name ,
718
+ )
720
719
721
720
# Mock the actual call within the gRPC stub, and fake the request.
722
721
with mock .patch .object (type (client .transport .list_instances ), "__call__" ) as call :
@@ -815,9 +814,8 @@ async def test_list_instances_async_pages():
815
814
assert page_ .raw_page .next_page_token == token
816
815
817
816
818
- def test_get_instance (
819
- transport : str = "grpc" , request_type = cloud_redis .GetInstanceRequest
820
- ):
817
+ @pytest .mark .parametrize ("request_type" , [cloud_redis .GetInstanceRequest , dict ,])
818
+ def test_get_instance (request_type , transport : str = "grpc" ):
821
819
client = CloudRedisClient (
822
820
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
823
821
)
@@ -885,10 +883,6 @@ def test_get_instance(
885
883
)
886
884
887
885
888
- def test_get_instance_from_dict ():
889
- test_get_instance (request_type = dict )
890
-
891
-
892
886
def test_get_instance_empty_call ():
893
887
# This test is a coverage failsafe to make sure that totally empty calls,
894
888
# i.e. request == None and no flattened fields passed, work.
@@ -1101,9 +1095,8 @@ async def test_get_instance_flattened_error_async():
1101
1095
)
1102
1096
1103
1097
1104
- def test_create_instance (
1105
- transport : str = "grpc" , request_type = cloud_redis .CreateInstanceRequest
1106
- ):
1098
+ @pytest .mark .parametrize ("request_type" , [cloud_redis .CreateInstanceRequest , dict ,])
1099
+ def test_create_instance (request_type , transport : str = "grpc" ):
1107
1100
client = CloudRedisClient (
1108
1101
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
1109
1102
)
@@ -1127,10 +1120,6 @@ def test_create_instance(
1127
1120
assert isinstance (response , future .Future )
1128
1121
1129
1122
1130
- def test_create_instance_from_dict ():
1131
- test_create_instance (request_type = dict )
1132
-
1133
-
1134
1123
def test_create_instance_empty_call ():
1135
1124
# This test is a coverage failsafe to make sure that totally empty calls,
1136
1125
# i.e. request == None and no flattened fields passed, work.
@@ -1325,9 +1314,8 @@ async def test_create_instance_flattened_error_async():
1325
1314
)
1326
1315
1327
1316
1328
- def test_update_instance (
1329
- transport : str = "grpc" , request_type = cloud_redis .UpdateInstanceRequest
1330
- ):
1317
+ @pytest .mark .parametrize ("request_type" , [cloud_redis .UpdateInstanceRequest , dict ,])
1318
+ def test_update_instance (request_type , transport : str = "grpc" ):
1331
1319
client = CloudRedisClient (
1332
1320
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
1333
1321
)
@@ -1351,10 +1339,6 @@ def test_update_instance(
1351
1339
assert isinstance (response , future .Future )
1352
1340
1353
1341
1354
- def test_update_instance_from_dict ():
1355
- test_update_instance (request_type = dict )
1356
-
1357
-
1358
1342
def test_update_instance_empty_call ():
1359
1343
# This test is a coverage failsafe to make sure that totally empty calls,
1360
1344
# i.e. request == None and no flattened fields passed, work.
@@ -1543,9 +1527,8 @@ async def test_update_instance_flattened_error_async():
1543
1527
)
1544
1528
1545
1529
1546
- def test_upgrade_instance (
1547
- transport : str = "grpc" , request_type = cloud_redis .UpgradeInstanceRequest
1548
- ):
1530
+ @pytest .mark .parametrize ("request_type" , [cloud_redis .UpgradeInstanceRequest , dict ,])
1531
+ def test_upgrade_instance (request_type , transport : str = "grpc" ):
1549
1532
client = CloudRedisClient (
1550
1533
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
1551
1534
)
@@ -1569,10 +1552,6 @@ def test_upgrade_instance(
1569
1552
assert isinstance (response , future .Future )
1570
1553
1571
1554
1572
- def test_upgrade_instance_from_dict ():
1573
- test_upgrade_instance (request_type = dict )
1574
-
1575
-
1576
1555
def test_upgrade_instance_empty_call ():
1577
1556
# This test is a coverage failsafe to make sure that totally empty calls,
1578
1557
# i.e. request == None and no flattened fields passed, work.
@@ -1755,9 +1734,8 @@ async def test_upgrade_instance_flattened_error_async():
1755
1734
)
1756
1735
1757
1736
1758
- def test_import_instance (
1759
- transport : str = "grpc" , request_type = cloud_redis .ImportInstanceRequest
1760
- ):
1737
+ @pytest .mark .parametrize ("request_type" , [cloud_redis .ImportInstanceRequest , dict ,])
1738
+ def test_import_instance (request_type , transport : str = "grpc" ):
1761
1739
client = CloudRedisClient (
1762
1740
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
1763
1741
)
@@ -1781,10 +1759,6 @@ def test_import_instance(
1781
1759
assert isinstance (response , future .Future )
1782
1760
1783
1761
1784
- def test_import_instance_from_dict ():
1785
- test_import_instance (request_type = dict )
1786
-
1787
-
1788
1762
def test_import_instance_empty_call ():
1789
1763
# This test is a coverage failsafe to make sure that totally empty calls,
1790
1764
# i.e. request == None and no flattened fields passed, work.
@@ -1981,9 +1955,8 @@ async def test_import_instance_flattened_error_async():
1981
1955
)
1982
1956
1983
1957
1984
- def test_export_instance (
1985
- transport : str = "grpc" , request_type = cloud_redis .ExportInstanceRequest
1986
- ):
1958
+ @pytest .mark .parametrize ("request_type" , [cloud_redis .ExportInstanceRequest , dict ,])
1959
+ def test_export_instance (request_type , transport : str = "grpc" ):
1987
1960
client = CloudRedisClient (
1988
1961
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
1989
1962
)
@@ -2007,10 +1980,6 @@ def test_export_instance(
2007
1980
assert isinstance (response , future .Future )
2008
1981
2009
1982
2010
- def test_export_instance_from_dict ():
2011
- test_export_instance (request_type = dict )
2012
-
2013
-
2014
1983
def test_export_instance_empty_call ():
2015
1984
# This test is a coverage failsafe to make sure that totally empty calls,
2016
1985
# i.e. request == None and no flattened fields passed, work.
@@ -2207,9 +2176,8 @@ async def test_export_instance_flattened_error_async():
2207
2176
)
2208
2177
2209
2178
2210
- def test_failover_instance (
2211
- transport : str = "grpc" , request_type = cloud_redis .FailoverInstanceRequest
2212
- ):
2179
+ @pytest .mark .parametrize ("request_type" , [cloud_redis .FailoverInstanceRequest , dict ,])
2180
+ def test_failover_instance (request_type , transport : str = "grpc" ):
2213
2181
client = CloudRedisClient (
2214
2182
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
2215
2183
)
@@ -2235,10 +2203,6 @@ def test_failover_instance(
2235
2203
assert isinstance (response , future .Future )
2236
2204
2237
2205
2238
- def test_failover_instance_from_dict ():
2239
- test_failover_instance (request_type = dict )
2240
-
2241
-
2242
2206
def test_failover_instance_empty_call ():
2243
2207
# This test is a coverage failsafe to make sure that totally empty calls,
2244
2208
# i.e. request == None and no flattened fields passed, work.
@@ -2439,9 +2403,8 @@ async def test_failover_instance_flattened_error_async():
2439
2403
)
2440
2404
2441
2405
2442
- def test_delete_instance (
2443
- transport : str = "grpc" , request_type = cloud_redis .DeleteInstanceRequest
2444
- ):
2406
+ @pytest .mark .parametrize ("request_type" , [cloud_redis .DeleteInstanceRequest , dict ,])
2407
+ def test_delete_instance (request_type , transport : str = "grpc" ):
2445
2408
client = CloudRedisClient (
2446
2409
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
2447
2410
)
@@ -2465,10 +2428,6 @@ def test_delete_instance(
2465
2428
assert isinstance (response , future .Future )
2466
2429
2467
2430
2468
- def test_delete_instance_from_dict ():
2469
- test_delete_instance (request_type = dict )
2470
-
2471
-
2472
2431
def test_delete_instance_empty_call ():
2473
2432
# This test is a coverage failsafe to make sure that totally empty calls,
2474
2433
# i.e. request == None and no flattened fields passed, work.
@@ -3173,7 +3132,7 @@ def test_parse_common_location_path():
3173
3132
assert expected == actual
3174
3133
3175
3134
3176
- def test_client_withDEFAULT_CLIENT_INFO ():
3135
+ def test_client_with_default_client_info ():
3177
3136
client_info = gapic_v1 .client_info .ClientInfo ()
3178
3137
3179
3138
with mock .patch .object (
0 commit comments