Skip to content
This repository was archived by the owner on Sep 5, 2023. It is now read-only.

Commit b51b1f2

Browse files
chore: use gapic-generator-python 0.58.4 (#111)
* chore: use gapic-generator-python 0.58.4 fix: provide appropriate mock values for message body fields committer: dovs PiperOrigin-RevId: 419025932 Source-Link: googleapis/googleapis@73da669 Source-Link: https://github.com/googleapis/googleapis-gen/commit/46df624a54b9ed47c1a7eefb7a49413cf7b82f98 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDZkZjYyNGE1NGI5ZWQ0N2MxYTdlZWZiN2E0OTQxM2NmN2I4MmY5OCJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
1 parent 00c6e7f commit b51b1f2

File tree

4 files changed

+36
-58
lines changed

4 files changed

+36
-58
lines changed

google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/base.py

-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ def __init__(
9999
credentials, _ = google.auth.load_credentials_from_file(
100100
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
101101
)
102-
103102
elif credentials is None:
104103
credentials, _ = google.auth.default(
105104
**scopes_kwargs, quota_project_id=quota_project_id

google/cloud/dataqna_v1alpha/services/question_service/transports/base.py

-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ def __init__(
103103
credentials, _ = google.auth.load_credentials_from_file(
104104
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
105105
)
106-
107106
elif credentials is None:
108107
credentials, _ = google.auth.default(
109108
**scopes_kwargs, quota_project_id=quota_project_id

tests/unit/gapic/dataqna_v1alpha/test_auto_suggestion_service.py

+11-14
Original file line numberDiff line numberDiff line change
@@ -254,20 +254,20 @@ def test_auto_suggestion_service_client_client_options(
254254
# unsupported value.
255255
with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}):
256256
with pytest.raises(MutualTLSChannelError):
257-
client = client_class()
257+
client = client_class(transport=transport_name)
258258

259259
# Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
260260
with mock.patch.dict(
261261
os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}
262262
):
263263
with pytest.raises(ValueError):
264-
client = client_class()
264+
client = client_class(transport=transport_name)
265265

266266
# Check the case quota_project_id is provided
267267
options = client_options.ClientOptions(quota_project_id="octopus")
268268
with mock.patch.object(transport_class, "__init__") as patched:
269269
patched.return_value = None
270-
client = client_class(transport=transport_name, client_options=options)
270+
client = client_class(client_options=options, transport=transport_name)
271271
patched.assert_called_once_with(
272272
credentials=None,
273273
credentials_file=None,
@@ -336,7 +336,7 @@ def test_auto_suggestion_service_client_mtls_env_auto(
336336
)
337337
with mock.patch.object(transport_class, "__init__") as patched:
338338
patched.return_value = None
339-
client = client_class(transport=transport_name, client_options=options)
339+
client = client_class(client_options=options, transport=transport_name)
340340

341341
if use_client_cert_env == "false":
342342
expected_client_cert_source = None
@@ -435,7 +435,7 @@ def test_auto_suggestion_service_client_client_options_scopes(
435435
options = client_options.ClientOptions(scopes=["1", "2"],)
436436
with mock.patch.object(transport_class, "__init__") as patched:
437437
patched.return_value = None
438-
client = client_class(transport=transport_name, client_options=options)
438+
client = client_class(client_options=options, transport=transport_name)
439439
patched.assert_called_once_with(
440440
credentials=None,
441441
credentials_file=None,
@@ -470,7 +470,7 @@ def test_auto_suggestion_service_client_client_options_credentials_file(
470470
options = client_options.ClientOptions(credentials_file="credentials.json")
471471
with mock.patch.object(transport_class, "__init__") as patched:
472472
patched.return_value = None
473-
client = client_class(transport=transport_name, client_options=options)
473+
client = client_class(client_options=options, transport=transport_name)
474474
patched.assert_called_once_with(
475475
credentials=None,
476476
credentials_file="credentials.json",
@@ -503,9 +503,10 @@ def test_auto_suggestion_service_client_client_options_from_dict():
503503
)
504504

505505

506-
def test_suggest_queries(
507-
transport: str = "grpc", request_type=auto_suggestion_service.SuggestQueriesRequest
508-
):
506+
@pytest.mark.parametrize(
507+
"request_type", [auto_suggestion_service.SuggestQueriesRequest, dict,]
508+
)
509+
def test_suggest_queries(request_type, transport: str = "grpc"):
509510
client = AutoSuggestionServiceClient(
510511
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
511512
)
@@ -529,10 +530,6 @@ def test_suggest_queries(
529530
assert isinstance(response, auto_suggestion_service.SuggestQueriesResponse)
530531

531532

532-
def test_suggest_queries_from_dict():
533-
test_suggest_queries(request_type=dict)
534-
535-
536533
def test_suggest_queries_empty_call():
537534
# This test is a coverage failsafe to make sure that totally empty calls,
538535
# i.e. request == None and no flattened fields passed, work.
@@ -1132,7 +1129,7 @@ def test_parse_common_location_path():
11321129
assert expected == actual
11331130

11341131

1135-
def test_client_withDEFAULT_CLIENT_INFO():
1132+
def test_client_with_default_client_info():
11361133
client_info = gapic_v1.client_info.ClientInfo()
11371134

11381135
with mock.patch.object(

tests/unit/gapic/dataqna_v1alpha/test_question_service.py

+25-42
Original file line numberDiff line numberDiff line change
@@ -256,20 +256,20 @@ def test_question_service_client_client_options(
256256
# unsupported value.
257257
with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}):
258258
with pytest.raises(MutualTLSChannelError):
259-
client = client_class()
259+
client = client_class(transport=transport_name)
260260

261261
# Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
262262
with mock.patch.dict(
263263
os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}
264264
):
265265
with pytest.raises(ValueError):
266-
client = client_class()
266+
client = client_class(transport=transport_name)
267267

268268
# Check the case quota_project_id is provided
269269
options = client_options.ClientOptions(quota_project_id="octopus")
270270
with mock.patch.object(transport_class, "__init__") as patched:
271271
patched.return_value = None
272-
client = client_class(transport=transport_name, client_options=options)
272+
client = client_class(client_options=options, transport=transport_name)
273273
patched.assert_called_once_with(
274274
credentials=None,
275275
credentials_file=None,
@@ -338,7 +338,7 @@ def test_question_service_client_mtls_env_auto(
338338
)
339339
with mock.patch.object(transport_class, "__init__") as patched:
340340
patched.return_value = None
341-
client = client_class(transport=transport_name, client_options=options)
341+
client = client_class(client_options=options, transport=transport_name)
342342

343343
if use_client_cert_env == "false":
344344
expected_client_cert_source = None
@@ -433,7 +433,7 @@ def test_question_service_client_client_options_scopes(
433433
options = client_options.ClientOptions(scopes=["1", "2"],)
434434
with mock.patch.object(transport_class, "__init__") as patched:
435435
patched.return_value = None
436-
client = client_class(transport=transport_name, client_options=options)
436+
client = client_class(client_options=options, transport=transport_name)
437437
patched.assert_called_once_with(
438438
credentials=None,
439439
credentials_file=None,
@@ -464,7 +464,7 @@ def test_question_service_client_client_options_credentials_file(
464464
options = client_options.ClientOptions(credentials_file="credentials.json")
465465
with mock.patch.object(transport_class, "__init__") as patched:
466466
patched.return_value = None
467-
client = client_class(transport=transport_name, client_options=options)
467+
client = client_class(client_options=options, transport=transport_name)
468468
patched.assert_called_once_with(
469469
credentials=None,
470470
credentials_file="credentials.json",
@@ -497,9 +497,8 @@ def test_question_service_client_client_options_from_dict():
497497
)
498498

499499

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"):
503502
client = QuestionServiceClient(
504503
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
505504
)
@@ -534,10 +533,6 @@ def test_get_question(
534533
assert response.user_email == "user_email_value"
535534

536535

537-
def test_get_question_from_dict():
538-
test_get_question(request_type=dict)
539-
540-
541536
def test_get_question_empty_call():
542537
# This test is a coverage failsafe to make sure that totally empty calls,
543538
# i.e. request == None and no flattened fields passed, work.
@@ -719,9 +714,10 @@ async def test_get_question_flattened_error_async():
719714
)
720715

721716

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"):
725721
client = QuestionServiceClient(
726722
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
727723
)
@@ -756,10 +752,6 @@ def test_create_question(
756752
assert response.user_email == "user_email_value"
757753

758754

759-
def test_create_question_from_dict():
760-
test_create_question(request_type=dict)
761-
762-
763755
def test_create_question_empty_call():
764756
# This test is a coverage failsafe to make sure that totally empty calls,
765757
# i.e. request == None and no flattened fields passed, work.
@@ -959,9 +951,10 @@ async def test_create_question_flattened_error_async():
959951
)
960952

961953

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"):
965958
client = QuestionServiceClient(
966959
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
967960
)
@@ -996,10 +989,6 @@ def test_execute_question(
996989
assert response.user_email == "user_email_value"
997990

998991

999-
def test_execute_question_from_dict():
1000-
test_execute_question(request_type=dict)
1001-
1002-
1003992
def test_execute_question_empty_call():
1004993
# This test is a coverage failsafe to make sure that totally empty calls,
1005994
# i.e. request == None and no flattened fields passed, work.
@@ -1196,9 +1185,10 @@ async def test_execute_question_flattened_error_async():
11961185
)
11971186

11981187

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"):
12021192
client = QuestionServiceClient(
12031193
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
12041194
)
@@ -1231,10 +1221,6 @@ def test_get_user_feedback(
12311221
assert response.rating == user_feedback.UserFeedback.UserFeedbackRating.POSITIVE
12321222

12331223

1234-
def test_get_user_feedback_from_dict():
1235-
test_get_user_feedback(request_type=dict)
1236-
1237-
12381224
def test_get_user_feedback_empty_call():
12391225
# This test is a coverage failsafe to make sure that totally empty calls,
12401226
# i.e. request == None and no flattened fields passed, work.
@@ -1429,9 +1415,10 @@ async def test_get_user_feedback_flattened_error_async():
14291415
)
14301416

14311417

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"):
14351422
client = QuestionServiceClient(
14361423
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
14371424
)
@@ -1464,10 +1451,6 @@ def test_update_user_feedback(
14641451
assert response.rating == gcd_user_feedback.UserFeedback.UserFeedbackRating.POSITIVE
14651452

14661453

1467-
def test_update_user_feedback_from_dict():
1468-
test_update_user_feedback(request_type=dict)
1469-
1470-
14711454
def test_update_user_feedback_empty_call():
14721455
# This test is a coverage failsafe to make sure that totally empty calls,
14731456
# i.e. request == None and no flattened fields passed, work.
@@ -2226,7 +2209,7 @@ def test_parse_common_location_path():
22262209
assert expected == actual
22272210

22282211

2229-
def test_client_withDEFAULT_CLIENT_INFO():
2212+
def test_client_with_default_client_info():
22302213
client_info = gapic_v1.client_info.ClientInfo()
22312214

22322215
with mock.patch.object(

0 commit comments

Comments
 (0)