Skip to content

Commit

Permalink
chore: use gapic-generator-python 0.58.4 (#55)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Jan 8, 2022
1 parent 262f6b6 commit 49cac2f
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ def __init__(
credentials, _ = google.auth.load_credentials_from_file(
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
)

elif credentials is None:
credentials, _ = google.auth.default(
**scopes_kwargs, quota_project_id=quota_project_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,20 +243,20 @@ def test_data_fusion_client_client_options(
# unsupported value.
with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}):
with pytest.raises(MutualTLSChannelError):
client = client_class()
client = client_class(transport=transport_name)

# Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
with mock.patch.dict(
os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}
):
with pytest.raises(ValueError):
client = client_class()
client = client_class(transport=transport_name)

# Check the case quota_project_id is provided
options = client_options.ClientOptions(quota_project_id="octopus")
with mock.patch.object(transport_class, "__init__") as patched:
patched.return_value = None
client = client_class(transport=transport_name, client_options=options)
client = client_class(client_options=options, transport=transport_name)
patched.assert_called_once_with(
credentials=None,
credentials_file=None,
Expand Down Expand Up @@ -313,7 +313,7 @@ def test_data_fusion_client_mtls_env_auto(
)
with mock.patch.object(transport_class, "__init__") as patched:
patched.return_value = None
client = client_class(transport=transport_name, client_options=options)
client = client_class(client_options=options, transport=transport_name)

if use_client_cert_env == "false":
expected_client_cert_source = None
Expand Down Expand Up @@ -408,7 +408,7 @@ def test_data_fusion_client_client_options_scopes(
options = client_options.ClientOptions(scopes=["1", "2"],)
with mock.patch.object(transport_class, "__init__") as patched:
patched.return_value = None
client = client_class(transport=transport_name, client_options=options)
client = client_class(client_options=options, transport=transport_name)
patched.assert_called_once_with(
credentials=None,
credentials_file=None,
Expand Down Expand Up @@ -439,7 +439,7 @@ def test_data_fusion_client_client_options_credentials_file(
options = client_options.ClientOptions(credentials_file="credentials.json")
with mock.patch.object(transport_class, "__init__") as patched:
patched.return_value = None
client = client_class(transport=transport_name, client_options=options)
client = client_class(client_options=options, transport=transport_name)
patched.assert_called_once_with(
credentials=None,
credentials_file="credentials.json",
Expand Down Expand Up @@ -470,9 +470,10 @@ def test_data_fusion_client_client_options_from_dict():
)


def test_list_available_versions(
transport: str = "grpc", request_type=datafusion.ListAvailableVersionsRequest
):
@pytest.mark.parametrize(
"request_type", [datafusion.ListAvailableVersionsRequest, dict,]
)
def test_list_available_versions(request_type, transport: str = "grpc"):
client = DataFusionClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -501,10 +502,6 @@ def test_list_available_versions(
assert response.next_page_token == "next_page_token_value"


def test_list_available_versions_from_dict():
test_list_available_versions(request_type=dict)


def test_list_available_versions_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
Expand Down Expand Up @@ -689,8 +686,10 @@ async def test_list_available_versions_flattened_error_async():
)


def test_list_available_versions_pager():
client = DataFusionClient(credentials=ga_credentials.AnonymousCredentials,)
def test_list_available_versions_pager(transport_name: str = "grpc"):
client = DataFusionClient(
credentials=ga_credentials.AnonymousCredentials, transport=transport_name,
)

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


def test_list_available_versions_pages():
client = DataFusionClient(credentials=ga_credentials.AnonymousCredentials,)
def test_list_available_versions_pages(transport_name: str = "grpc"):
client = DataFusionClient(
credentials=ga_credentials.AnonymousCredentials, transport=transport_name,
)

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


def test_list_instances(
transport: str = "grpc", request_type=datafusion.ListInstancesRequest
):
@pytest.mark.parametrize("request_type", [datafusion.ListInstancesRequest, dict,])
def test_list_instances(request_type, transport: str = "grpc"):
client = DataFusionClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -873,10 +873,6 @@ def test_list_instances(
assert response.unreachable == ["unreachable_value"]


def test_list_instances_from_dict():
test_list_instances(request_type=dict)


def test_list_instances_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
Expand Down Expand Up @@ -982,8 +978,10 @@ async def test_list_instances_field_headers_async():
assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]


def test_list_instances_pager():
client = DataFusionClient(credentials=ga_credentials.AnonymousCredentials,)
def test_list_instances_pager(transport_name: str = "grpc"):
client = DataFusionClient(
credentials=ga_credentials.AnonymousCredentials, transport=transport_name,
)

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


def test_list_instances_pages():
client = DataFusionClient(credentials=ga_credentials.AnonymousCredentials,)
def test_list_instances_pages(transport_name: str = "grpc"):
client = DataFusionClient(
credentials=ga_credentials.AnonymousCredentials, transport=transport_name,
)

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


def test_get_instance(
transport: str = "grpc", request_type=datafusion.GetInstanceRequest
):
@pytest.mark.parametrize("request_type", [datafusion.GetInstanceRequest, dict,])
def test_get_instance(request_type, transport: str = "grpc"):
client = DataFusionClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -1185,10 +1184,6 @@ def test_get_instance(
assert response.enable_rbac is True


def test_get_instance_from_dict():
test_get_instance(request_type=dict)


def test_get_instance_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
Expand Down Expand Up @@ -1326,9 +1321,8 @@ async def test_get_instance_field_headers_async():
assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]


def test_create_instance(
transport: str = "grpc", request_type=datafusion.CreateInstanceRequest
):
@pytest.mark.parametrize("request_type", [datafusion.CreateInstanceRequest, dict,])
def test_create_instance(request_type, transport: str = "grpc"):
client = DataFusionClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand All @@ -1352,10 +1346,6 @@ def test_create_instance(
assert isinstance(response, future.Future)


def test_create_instance_from_dict():
test_create_instance(request_type=dict)


def test_create_instance_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
Expand Down Expand Up @@ -1550,9 +1540,8 @@ async def test_create_instance_flattened_error_async():
)


def test_delete_instance(
transport: str = "grpc", request_type=datafusion.DeleteInstanceRequest
):
@pytest.mark.parametrize("request_type", [datafusion.DeleteInstanceRequest, dict,])
def test_delete_instance(request_type, transport: str = "grpc"):
client = DataFusionClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand All @@ -1576,10 +1565,6 @@ def test_delete_instance(
assert isinstance(response, future.Future)


def test_delete_instance_from_dict():
test_delete_instance(request_type=dict)


def test_delete_instance_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
Expand Down Expand Up @@ -1748,9 +1733,8 @@ async def test_delete_instance_flattened_error_async():
)


def test_update_instance(
transport: str = "grpc", request_type=datafusion.UpdateInstanceRequest
):
@pytest.mark.parametrize("request_type", [datafusion.UpdateInstanceRequest, dict,])
def test_update_instance(request_type, transport: str = "grpc"):
client = DataFusionClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand All @@ -1774,10 +1758,6 @@ def test_update_instance(
assert isinstance(response, future.Future)


def test_update_instance_from_dict():
test_update_instance(request_type=dict)


def test_update_instance_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
Expand Down Expand Up @@ -1966,9 +1946,8 @@ async def test_update_instance_flattened_error_async():
)


def test_restart_instance(
transport: str = "grpc", request_type=datafusion.RestartInstanceRequest
):
@pytest.mark.parametrize("request_type", [datafusion.RestartInstanceRequest, dict,])
def test_restart_instance(request_type, transport: str = "grpc"):
client = DataFusionClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand All @@ -1992,10 +1971,6 @@ def test_restart_instance(
assert isinstance(response, future.Future)


def test_restart_instance_from_dict():
test_restart_instance(request_type=dict)


def test_restart_instance_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
Expand Down Expand Up @@ -2630,7 +2605,7 @@ def test_parse_common_location_path():
assert expected == actual


def test_client_withDEFAULT_CLIENT_INFO():
def test_client_with_default_client_info():
client_info = gapic_v1.client_info.ClientInfo()

with mock.patch.object(
Expand Down

0 comments on commit 49cac2f

Please sign in to comment.