Skip to content

Commit 49cac2f

Browse files
chore: use gapic-generator-python 0.58.4 (#55)
* 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: googleapis/googleapis-gen@46df624 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>
1 parent 262f6b6 commit 49cac2f

File tree

2 files changed

+39
-65
lines changed
  • packages/google-cloud-data-fusion

2 files changed

+39
-65
lines changed

packages/google-cloud-data-fusion/google/cloud/data_fusion_v1/services/data_fusion/transports/base.py

Lines changed: 0 additions & 1 deletion
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

packages/google-cloud-data-fusion/tests/unit/gapic/data_fusion_v1/test_data_fusion.py

Lines changed: 39 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -243,20 +243,20 @@ def test_data_fusion_client_client_options(
243243
# unsupported value.
244244
with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}):
245245
with pytest.raises(MutualTLSChannelError):
246-
client = client_class()
246+
client = client_class(transport=transport_name)
247247

248248
# Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
249249
with mock.patch.dict(
250250
os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}
251251
):
252252
with pytest.raises(ValueError):
253-
client = client_class()
253+
client = client_class(transport=transport_name)
254254

255255
# Check the case quota_project_id is provided
256256
options = client_options.ClientOptions(quota_project_id="octopus")
257257
with mock.patch.object(transport_class, "__init__") as patched:
258258
patched.return_value = None
259-
client = client_class(transport=transport_name, client_options=options)
259+
client = client_class(client_options=options, transport=transport_name)
260260
patched.assert_called_once_with(
261261
credentials=None,
262262
credentials_file=None,
@@ -313,7 +313,7 @@ def test_data_fusion_client_mtls_env_auto(
313313
)
314314
with mock.patch.object(transport_class, "__init__") as patched:
315315
patched.return_value = None
316-
client = client_class(transport=transport_name, client_options=options)
316+
client = client_class(client_options=options, transport=transport_name)
317317

318318
if use_client_cert_env == "false":
319319
expected_client_cert_source = None
@@ -408,7 +408,7 @@ def test_data_fusion_client_client_options_scopes(
408408
options = client_options.ClientOptions(scopes=["1", "2"],)
409409
with mock.patch.object(transport_class, "__init__") as patched:
410410
patched.return_value = None
411-
client = client_class(transport=transport_name, client_options=options)
411+
client = client_class(client_options=options, transport=transport_name)
412412
patched.assert_called_once_with(
413413
credentials=None,
414414
credentials_file=None,
@@ -439,7 +439,7 @@ def test_data_fusion_client_client_options_credentials_file(
439439
options = client_options.ClientOptions(credentials_file="credentials.json")
440440
with mock.patch.object(transport_class, "__init__") as patched:
441441
patched.return_value = None
442-
client = client_class(transport=transport_name, client_options=options)
442+
client = client_class(client_options=options, transport=transport_name)
443443
patched.assert_called_once_with(
444444
credentials=None,
445445
credentials_file="credentials.json",
@@ -470,9 +470,10 @@ def test_data_fusion_client_client_options_from_dict():
470470
)
471471

472472

473-
def test_list_available_versions(
474-
transport: str = "grpc", request_type=datafusion.ListAvailableVersionsRequest
475-
):
473+
@pytest.mark.parametrize(
474+
"request_type", [datafusion.ListAvailableVersionsRequest, dict,]
475+
)
476+
def test_list_available_versions(request_type, transport: str = "grpc"):
476477
client = DataFusionClient(
477478
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
478479
)
@@ -501,10 +502,6 @@ def test_list_available_versions(
501502
assert response.next_page_token == "next_page_token_value"
502503

503504

504-
def test_list_available_versions_from_dict():
505-
test_list_available_versions(request_type=dict)
506-
507-
508505
def test_list_available_versions_empty_call():
509506
# This test is a coverage failsafe to make sure that totally empty calls,
510507
# i.e. request == None and no flattened fields passed, work.
@@ -689,8 +686,10 @@ async def test_list_available_versions_flattened_error_async():
689686
)
690687

691688

692-
def test_list_available_versions_pager():
693-
client = DataFusionClient(credentials=ga_credentials.AnonymousCredentials,)
689+
def test_list_available_versions_pager(transport_name: str = "grpc"):
690+
client = DataFusionClient(
691+
credentials=ga_credentials.AnonymousCredentials, transport=transport_name,
692+
)
694693

695694
# Mock the actual call within the gRPC stub, and fake the request.
696695
with mock.patch.object(
@@ -731,8 +730,10 @@ def test_list_available_versions_pager():
731730
assert all(isinstance(i, datafusion.Version) for i in results)
732731

733732

734-
def test_list_available_versions_pages():
735-
client = DataFusionClient(credentials=ga_credentials.AnonymousCredentials,)
733+
def test_list_available_versions_pages(transport_name: str = "grpc"):
734+
client = DataFusionClient(
735+
credentials=ga_credentials.AnonymousCredentials, transport=transport_name,
736+
)
736737

737738
# Mock the actual call within the gRPC stub, and fake the request.
738739
with mock.patch.object(
@@ -843,9 +844,8 @@ async def test_list_available_versions_async_pages():
843844
assert page_.raw_page.next_page_token == token
844845

845846

846-
def test_list_instances(
847-
transport: str = "grpc", request_type=datafusion.ListInstancesRequest
848-
):
847+
@pytest.mark.parametrize("request_type", [datafusion.ListInstancesRequest, dict,])
848+
def test_list_instances(request_type, transport: str = "grpc"):
849849
client = DataFusionClient(
850850
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
851851
)
@@ -873,10 +873,6 @@ def test_list_instances(
873873
assert response.unreachable == ["unreachable_value"]
874874

875875

876-
def test_list_instances_from_dict():
877-
test_list_instances(request_type=dict)
878-
879-
880876
def test_list_instances_empty_call():
881877
# This test is a coverage failsafe to make sure that totally empty calls,
882878
# i.e. request == None and no flattened fields passed, work.
@@ -982,8 +978,10 @@ async def test_list_instances_field_headers_async():
982978
assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
983979

984980

985-
def test_list_instances_pager():
986-
client = DataFusionClient(credentials=ga_credentials.AnonymousCredentials,)
981+
def test_list_instances_pager(transport_name: str = "grpc"):
982+
client = DataFusionClient(
983+
credentials=ga_credentials.AnonymousCredentials, transport=transport_name,
984+
)
987985

988986
# Mock the actual call within the gRPC stub, and fake the request.
989987
with mock.patch.object(type(client.transport.list_instances), "__call__") as call:
@@ -1020,8 +1018,10 @@ def test_list_instances_pager():
10201018
assert all(isinstance(i, datafusion.Instance) for i in results)
10211019

10221020

1023-
def test_list_instances_pages():
1024-
client = DataFusionClient(credentials=ga_credentials.AnonymousCredentials,)
1021+
def test_list_instances_pages(transport_name: str = "grpc"):
1022+
client = DataFusionClient(
1023+
credentials=ga_credentials.AnonymousCredentials, transport=transport_name,
1024+
)
10251025

10261026
# Mock the actual call within the gRPC stub, and fake the request.
10271027
with mock.patch.object(type(client.transport.list_instances), "__call__") as call:
@@ -1120,9 +1120,8 @@ async def test_list_instances_async_pages():
11201120
assert page_.raw_page.next_page_token == token
11211121

11221122

1123-
def test_get_instance(
1124-
transport: str = "grpc", request_type=datafusion.GetInstanceRequest
1125-
):
1123+
@pytest.mark.parametrize("request_type", [datafusion.GetInstanceRequest, dict,])
1124+
def test_get_instance(request_type, transport: str = "grpc"):
11261125
client = DataFusionClient(
11271126
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
11281127
)
@@ -1185,10 +1184,6 @@ def test_get_instance(
11851184
assert response.enable_rbac is True
11861185

11871186

1188-
def test_get_instance_from_dict():
1189-
test_get_instance(request_type=dict)
1190-
1191-
11921187
def test_get_instance_empty_call():
11931188
# This test is a coverage failsafe to make sure that totally empty calls,
11941189
# i.e. request == None and no flattened fields passed, work.
@@ -1326,9 +1321,8 @@ async def test_get_instance_field_headers_async():
13261321
assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
13271322

13281323

1329-
def test_create_instance(
1330-
transport: str = "grpc", request_type=datafusion.CreateInstanceRequest
1331-
):
1324+
@pytest.mark.parametrize("request_type", [datafusion.CreateInstanceRequest, dict,])
1325+
def test_create_instance(request_type, transport: str = "grpc"):
13321326
client = DataFusionClient(
13331327
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
13341328
)
@@ -1352,10 +1346,6 @@ def test_create_instance(
13521346
assert isinstance(response, future.Future)
13531347

13541348

1355-
def test_create_instance_from_dict():
1356-
test_create_instance(request_type=dict)
1357-
1358-
13591349
def test_create_instance_empty_call():
13601350
# This test is a coverage failsafe to make sure that totally empty calls,
13611351
# i.e. request == None and no flattened fields passed, work.
@@ -1550,9 +1540,8 @@ async def test_create_instance_flattened_error_async():
15501540
)
15511541

15521542

1553-
def test_delete_instance(
1554-
transport: str = "grpc", request_type=datafusion.DeleteInstanceRequest
1555-
):
1543+
@pytest.mark.parametrize("request_type", [datafusion.DeleteInstanceRequest, dict,])
1544+
def test_delete_instance(request_type, transport: str = "grpc"):
15561545
client = DataFusionClient(
15571546
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
15581547
)
@@ -1576,10 +1565,6 @@ def test_delete_instance(
15761565
assert isinstance(response, future.Future)
15771566

15781567

1579-
def test_delete_instance_from_dict():
1580-
test_delete_instance(request_type=dict)
1581-
1582-
15831568
def test_delete_instance_empty_call():
15841569
# This test is a coverage failsafe to make sure that totally empty calls,
15851570
# i.e. request == None and no flattened fields passed, work.
@@ -1748,9 +1733,8 @@ async def test_delete_instance_flattened_error_async():
17481733
)
17491734

17501735

1751-
def test_update_instance(
1752-
transport: str = "grpc", request_type=datafusion.UpdateInstanceRequest
1753-
):
1736+
@pytest.mark.parametrize("request_type", [datafusion.UpdateInstanceRequest, dict,])
1737+
def test_update_instance(request_type, transport: str = "grpc"):
17541738
client = DataFusionClient(
17551739
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
17561740
)
@@ -1774,10 +1758,6 @@ def test_update_instance(
17741758
assert isinstance(response, future.Future)
17751759

17761760

1777-
def test_update_instance_from_dict():
1778-
test_update_instance(request_type=dict)
1779-
1780-
17811761
def test_update_instance_empty_call():
17821762
# This test is a coverage failsafe to make sure that totally empty calls,
17831763
# i.e. request == None and no flattened fields passed, work.
@@ -1966,9 +1946,8 @@ async def test_update_instance_flattened_error_async():
19661946
)
19671947

19681948

1969-
def test_restart_instance(
1970-
transport: str = "grpc", request_type=datafusion.RestartInstanceRequest
1971-
):
1949+
@pytest.mark.parametrize("request_type", [datafusion.RestartInstanceRequest, dict,])
1950+
def test_restart_instance(request_type, transport: str = "grpc"):
19721951
client = DataFusionClient(
19731952
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
19741953
)
@@ -1992,10 +1971,6 @@ def test_restart_instance(
19921971
assert isinstance(response, future.Future)
19931972

19941973

1995-
def test_restart_instance_from_dict():
1996-
test_restart_instance(request_type=dict)
1997-
1998-
19991974
def test_restart_instance_empty_call():
20001975
# This test is a coverage failsafe to make sure that totally empty calls,
20011976
# i.e. request == None and no flattened fields passed, work.
@@ -2630,7 +2605,7 @@ def test_parse_common_location_path():
26302605
assert expected == actual
26312606

26322607

2633-
def test_client_withDEFAULT_CLIENT_INFO():
2608+
def test_client_with_default_client_info():
26342609
client_info = gapic_v1.client_info.ClientInfo()
26352610

26362611
with mock.patch.object(

0 commit comments

Comments
 (0)