@@ -256,20 +256,20 @@ def test_question_service_client_client_options(
256
256
# unsupported value.
257
257
with mock .patch .dict (os .environ , {"GOOGLE_API_USE_MTLS_ENDPOINT" : "Unsupported" }):
258
258
with pytest .raises (MutualTLSChannelError ):
259
- client = client_class ()
259
+ client = client_class (transport = transport_name )
260
260
261
261
# Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
262
262
with mock .patch .dict (
263
263
os .environ , {"GOOGLE_API_USE_CLIENT_CERTIFICATE" : "Unsupported" }
264
264
):
265
265
with pytest .raises (ValueError ):
266
- client = client_class ()
266
+ client = client_class (transport = transport_name )
267
267
268
268
# Check the case quota_project_id is provided
269
269
options = client_options .ClientOptions (quota_project_id = "octopus" )
270
270
with mock .patch .object (transport_class , "__init__" ) as patched :
271
271
patched .return_value = None
272
- client = client_class (transport = transport_name , client_options = options )
272
+ client = client_class (client_options = options , transport = transport_name )
273
273
patched .assert_called_once_with (
274
274
credentials = None ,
275
275
credentials_file = None ,
@@ -338,7 +338,7 @@ def test_question_service_client_mtls_env_auto(
338
338
)
339
339
with mock .patch .object (transport_class , "__init__" ) as patched :
340
340
patched .return_value = None
341
- client = client_class (transport = transport_name , client_options = options )
341
+ client = client_class (client_options = options , transport = transport_name )
342
342
343
343
if use_client_cert_env == "false" :
344
344
expected_client_cert_source = None
@@ -433,7 +433,7 @@ def test_question_service_client_client_options_scopes(
433
433
options = client_options .ClientOptions (scopes = ["1" , "2" ],)
434
434
with mock .patch .object (transport_class , "__init__" ) as patched :
435
435
patched .return_value = None
436
- client = client_class (transport = transport_name , client_options = options )
436
+ client = client_class (client_options = options , transport = transport_name )
437
437
patched .assert_called_once_with (
438
438
credentials = None ,
439
439
credentials_file = None ,
@@ -464,7 +464,7 @@ def test_question_service_client_client_options_credentials_file(
464
464
options = client_options .ClientOptions (credentials_file = "credentials.json" )
465
465
with mock .patch .object (transport_class , "__init__" ) as patched :
466
466
patched .return_value = None
467
- client = client_class (transport = transport_name , client_options = options )
467
+ client = client_class (client_options = options , transport = transport_name )
468
468
patched .assert_called_once_with (
469
469
credentials = None ,
470
470
credentials_file = "credentials.json" ,
@@ -497,9 +497,8 @@ def test_question_service_client_client_options_from_dict():
497
497
)
498
498
499
499
500
- def test_get_question (
501
- transport : str = "grpc" , request_type = question_service .GetQuestionRequest
502
- ):
500
+ @pytest .mark .parametrize ("request_type" , [question_service .GetQuestionRequest , dict ,])
501
+ def test_get_question (request_type , transport : str = "grpc" ):
503
502
client = QuestionServiceClient (
504
503
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
505
504
)
@@ -534,10 +533,6 @@ def test_get_question(
534
533
assert response .user_email == "user_email_value"
535
534
536
535
537
- def test_get_question_from_dict ():
538
- test_get_question (request_type = dict )
539
-
540
-
541
536
def test_get_question_empty_call ():
542
537
# This test is a coverage failsafe to make sure that totally empty calls,
543
538
# i.e. request == None and no flattened fields passed, work.
@@ -719,9 +714,10 @@ async def test_get_question_flattened_error_async():
719
714
)
720
715
721
716
722
- def test_create_question (
723
- transport : str = "grpc" , request_type = question_service .CreateQuestionRequest
724
- ):
717
+ @pytest .mark .parametrize (
718
+ "request_type" , [question_service .CreateQuestionRequest , dict ,]
719
+ )
720
+ def test_create_question (request_type , transport : str = "grpc" ):
725
721
client = QuestionServiceClient (
726
722
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
727
723
)
@@ -756,10 +752,6 @@ def test_create_question(
756
752
assert response .user_email == "user_email_value"
757
753
758
754
759
- def test_create_question_from_dict ():
760
- test_create_question (request_type = dict )
761
-
762
-
763
755
def test_create_question_empty_call ():
764
756
# This test is a coverage failsafe to make sure that totally empty calls,
765
757
# i.e. request == None and no flattened fields passed, work.
@@ -959,9 +951,10 @@ async def test_create_question_flattened_error_async():
959
951
)
960
952
961
953
962
- def test_execute_question (
963
- transport : str = "grpc" , request_type = question_service .ExecuteQuestionRequest
964
- ):
954
+ @pytest .mark .parametrize (
955
+ "request_type" , [question_service .ExecuteQuestionRequest , dict ,]
956
+ )
957
+ def test_execute_question (request_type , transport : str = "grpc" ):
965
958
client = QuestionServiceClient (
966
959
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
967
960
)
@@ -996,10 +989,6 @@ def test_execute_question(
996
989
assert response .user_email == "user_email_value"
997
990
998
991
999
- def test_execute_question_from_dict ():
1000
- test_execute_question (request_type = dict )
1001
-
1002
-
1003
992
def test_execute_question_empty_call ():
1004
993
# This test is a coverage failsafe to make sure that totally empty calls,
1005
994
# i.e. request == None and no flattened fields passed, work.
@@ -1196,9 +1185,10 @@ async def test_execute_question_flattened_error_async():
1196
1185
)
1197
1186
1198
1187
1199
- def test_get_user_feedback (
1200
- transport : str = "grpc" , request_type = question_service .GetUserFeedbackRequest
1201
- ):
1188
+ @pytest .mark .parametrize (
1189
+ "request_type" , [question_service .GetUserFeedbackRequest , dict ,]
1190
+ )
1191
+ def test_get_user_feedback (request_type , transport : str = "grpc" ):
1202
1192
client = QuestionServiceClient (
1203
1193
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
1204
1194
)
@@ -1231,10 +1221,6 @@ def test_get_user_feedback(
1231
1221
assert response .rating == user_feedback .UserFeedback .UserFeedbackRating .POSITIVE
1232
1222
1233
1223
1234
- def test_get_user_feedback_from_dict ():
1235
- test_get_user_feedback (request_type = dict )
1236
-
1237
-
1238
1224
def test_get_user_feedback_empty_call ():
1239
1225
# This test is a coverage failsafe to make sure that totally empty calls,
1240
1226
# i.e. request == None and no flattened fields passed, work.
@@ -1429,9 +1415,10 @@ async def test_get_user_feedback_flattened_error_async():
1429
1415
)
1430
1416
1431
1417
1432
- def test_update_user_feedback (
1433
- transport : str = "grpc" , request_type = question_service .UpdateUserFeedbackRequest
1434
- ):
1418
+ @pytest .mark .parametrize (
1419
+ "request_type" , [question_service .UpdateUserFeedbackRequest , dict ,]
1420
+ )
1421
+ def test_update_user_feedback (request_type , transport : str = "grpc" ):
1435
1422
client = QuestionServiceClient (
1436
1423
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
1437
1424
)
@@ -1464,10 +1451,6 @@ def test_update_user_feedback(
1464
1451
assert response .rating == gcd_user_feedback .UserFeedback .UserFeedbackRating .POSITIVE
1465
1452
1466
1453
1467
- def test_update_user_feedback_from_dict ():
1468
- test_update_user_feedback (request_type = dict )
1469
-
1470
-
1471
1454
def test_update_user_feedback_empty_call ():
1472
1455
# This test is a coverage failsafe to make sure that totally empty calls,
1473
1456
# i.e. request == None and no flattened fields passed, work.
@@ -2226,7 +2209,7 @@ def test_parse_common_location_path():
2226
2209
assert expected == actual
2227
2210
2228
2211
2229
- def test_client_withDEFAULT_CLIENT_INFO ():
2212
+ def test_client_with_default_client_info ():
2230
2213
client_info = gapic_v1 .client_info .ClientInfo ()
2231
2214
2232
2215
with mock .patch .object (
0 commit comments