@@ -253,20 +253,20 @@ def test_cloud_shell_service_client_client_options(
253
253
# unsupported value.
254
254
with mock .patch .dict (os .environ , {"GOOGLE_API_USE_MTLS_ENDPOINT" : "Unsupported" }):
255
255
with pytest .raises (MutualTLSChannelError ):
256
- client = client_class ()
256
+ client = client_class (transport = transport_name )
257
257
258
258
# Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
259
259
with mock .patch .dict (
260
260
os .environ , {"GOOGLE_API_USE_CLIENT_CERTIFICATE" : "Unsupported" }
261
261
):
262
262
with pytest .raises (ValueError ):
263
- client = client_class ()
263
+ client = client_class (transport = transport_name )
264
264
265
265
# Check the case quota_project_id is provided
266
266
options = client_options .ClientOptions (quota_project_id = "octopus" )
267
267
with mock .patch .object (transport_class , "__init__" ) as patched :
268
268
patched .return_value = None
269
- client = client_class (transport = transport_name , client_options = options )
269
+ client = client_class (client_options = options , transport = transport_name )
270
270
patched .assert_called_once_with (
271
271
credentials = None ,
272
272
credentials_file = None ,
@@ -335,7 +335,7 @@ def test_cloud_shell_service_client_mtls_env_auto(
335
335
)
336
336
with mock .patch .object (transport_class , "__init__" ) as patched :
337
337
patched .return_value = None
338
- client = client_class (transport = transport_name , client_options = options )
338
+ client = client_class (client_options = options , transport = transport_name )
339
339
340
340
if use_client_cert_env == "false" :
341
341
expected_client_cert_source = None
@@ -430,7 +430,7 @@ def test_cloud_shell_service_client_client_options_scopes(
430
430
options = client_options .ClientOptions (scopes = ["1" , "2" ],)
431
431
with mock .patch .object (transport_class , "__init__" ) as patched :
432
432
patched .return_value = None
433
- client = client_class (transport = transport_name , client_options = options )
433
+ client = client_class (client_options = options , transport = transport_name )
434
434
patched .assert_called_once_with (
435
435
credentials = None ,
436
436
credentials_file = None ,
@@ -461,7 +461,7 @@ def test_cloud_shell_service_client_client_options_credentials_file(
461
461
options = client_options .ClientOptions (credentials_file = "credentials.json" )
462
462
with mock .patch .object (transport_class , "__init__" ) as patched :
463
463
patched .return_value = None
464
- client = client_class (transport = transport_name , client_options = options )
464
+ client = client_class (client_options = options , transport = transport_name )
465
465
patched .assert_called_once_with (
466
466
credentials = None ,
467
467
credentials_file = "credentials.json" ,
@@ -494,9 +494,8 @@ def test_cloud_shell_service_client_client_options_from_dict():
494
494
)
495
495
496
496
497
- def test_get_environment (
498
- transport : str = "grpc" , request_type = cloudshell .GetEnvironmentRequest
499
- ):
497
+ @pytest .mark .parametrize ("request_type" , [cloudshell .GetEnvironmentRequest , dict ,])
498
+ def test_get_environment (request_type , transport : str = "grpc" ):
500
499
client = CloudShellServiceClient (
501
500
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
502
501
)
@@ -539,10 +538,6 @@ def test_get_environment(
539
538
assert response .public_keys == ["public_keys_value" ]
540
539
541
540
542
- def test_get_environment_from_dict ():
543
- test_get_environment (request_type = dict )
544
-
545
-
546
541
def test_get_environment_empty_call ():
547
542
# This test is a coverage failsafe to make sure that totally empty calls,
548
543
# i.e. request == None and no flattened fields passed, work.
@@ -736,9 +731,8 @@ async def test_get_environment_flattened_error_async():
736
731
)
737
732
738
733
739
- def test_start_environment (
740
- transport : str = "grpc" , request_type = cloudshell .StartEnvironmentRequest
741
- ):
734
+ @pytest .mark .parametrize ("request_type" , [cloudshell .StartEnvironmentRequest , dict ,])
735
+ def test_start_environment (request_type , transport : str = "grpc" ):
742
736
client = CloudShellServiceClient (
743
737
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
744
738
)
@@ -764,10 +758,6 @@ def test_start_environment(
764
758
assert isinstance (response , future .Future )
765
759
766
760
767
- def test_start_environment_from_dict ():
768
- test_start_environment (request_type = dict )
769
-
770
-
771
761
def test_start_environment_empty_call ():
772
762
# This test is a coverage failsafe to make sure that totally empty calls,
773
763
# i.e. request == None and no flattened fields passed, work.
@@ -878,9 +868,10 @@ async def test_start_environment_field_headers_async():
878
868
assert ("x-goog-request-params" , "name=name/value" ,) in kw ["metadata" ]
879
869
880
870
881
- def test_authorize_environment (
882
- transport : str = "grpc" , request_type = cloudshell .AuthorizeEnvironmentRequest
883
- ):
871
+ @pytest .mark .parametrize (
872
+ "request_type" , [cloudshell .AuthorizeEnvironmentRequest , dict ,]
873
+ )
874
+ def test_authorize_environment (request_type , transport : str = "grpc" ):
884
875
client = CloudShellServiceClient (
885
876
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
886
877
)
@@ -906,10 +897,6 @@ def test_authorize_environment(
906
897
assert isinstance (response , future .Future )
907
898
908
899
909
- def test_authorize_environment_from_dict ():
910
- test_authorize_environment (request_type = dict )
911
-
912
-
913
900
def test_authorize_environment_empty_call ():
914
901
# This test is a coverage failsafe to make sure that totally empty calls,
915
902
# i.e. request == None and no flattened fields passed, work.
@@ -1020,9 +1007,8 @@ async def test_authorize_environment_field_headers_async():
1020
1007
assert ("x-goog-request-params" , "name=name/value" ,) in kw ["metadata" ]
1021
1008
1022
1009
1023
- def test_add_public_key (
1024
- transport : str = "grpc" , request_type = cloudshell .AddPublicKeyRequest
1025
- ):
1010
+ @pytest .mark .parametrize ("request_type" , [cloudshell .AddPublicKeyRequest , dict ,])
1011
+ def test_add_public_key (request_type , transport : str = "grpc" ):
1026
1012
client = CloudShellServiceClient (
1027
1013
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
1028
1014
)
@@ -1046,10 +1032,6 @@ def test_add_public_key(
1046
1032
assert isinstance (response , future .Future )
1047
1033
1048
1034
1049
- def test_add_public_key_from_dict ():
1050
- test_add_public_key (request_type = dict )
1051
-
1052
-
1053
1035
def test_add_public_key_empty_call ():
1054
1036
# This test is a coverage failsafe to make sure that totally empty calls,
1055
1037
# i.e. request == None and no flattened fields passed, work.
@@ -1152,9 +1134,8 @@ async def test_add_public_key_field_headers_async():
1152
1134
assert ("x-goog-request-params" , "environment=environment/value" ,) in kw ["metadata" ]
1153
1135
1154
1136
1155
- def test_remove_public_key (
1156
- transport : str = "grpc" , request_type = cloudshell .RemovePublicKeyRequest
1157
- ):
1137
+ @pytest .mark .parametrize ("request_type" , [cloudshell .RemovePublicKeyRequest , dict ,])
1138
+ def test_remove_public_key (request_type , transport : str = "grpc" ):
1158
1139
client = CloudShellServiceClient (
1159
1140
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
1160
1141
)
@@ -1180,10 +1161,6 @@ def test_remove_public_key(
1180
1161
assert isinstance (response , future .Future )
1181
1162
1182
1163
1183
- def test_remove_public_key_from_dict ():
1184
- test_remove_public_key (request_type = dict )
1185
-
1186
-
1187
1164
def test_remove_public_key_empty_call ():
1188
1165
# This test is a coverage failsafe to make sure that totally empty calls,
1189
1166
# i.e. request == None and no flattened fields passed, work.
@@ -1843,7 +1820,7 @@ def test_parse_common_location_path():
1843
1820
assert expected == actual
1844
1821
1845
1822
1846
- def test_client_withDEFAULT_CLIENT_INFO ():
1823
+ def test_client_with_default_client_info ():
1847
1824
client_info = gapic_v1 .client_info .ClientInfo ()
1848
1825
1849
1826
with mock .patch .object (
0 commit comments