Skip to content

Commit

Permalink
chore: use gapic-generator-python 0.58.4 (#102)
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>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
  • Loading branch information
3 people authored Jan 8, 2022
1 parent 58a6a52 commit 5e8c1e0
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 159 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 @@ -101,7 +101,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 @@ -234,20 +234,20 @@ def test_gke_hub_client_client_options(client_class, transport_class, transport_
# 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 @@ -302,7 +302,7 @@ def test_gke_hub_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 @@ -393,7 +393,7 @@ def test_gke_hub_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 All @@ -420,7 +420,7 @@ def test_gke_hub_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 @@ -451,9 +451,8 @@ def test_gke_hub_client_client_options_from_dict():
)


def test_list_memberships(
transport: str = "grpc", request_type=service.ListMembershipsRequest
):
@pytest.mark.parametrize("request_type", [service.ListMembershipsRequest, dict,])
def test_list_memberships(request_type, transport: str = "grpc"):
client = GkeHubClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -481,10 +480,6 @@ def test_list_memberships(
assert response.unreachable == ["unreachable_value"]


def test_list_memberships_from_dict():
test_list_memberships(request_type=dict)


def test_list_memberships_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 @@ -658,8 +653,10 @@ async def test_list_memberships_flattened_error_async():
)


def test_list_memberships_pager():
client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials,)
def test_list_memberships_pager(transport_name: str = "grpc"):
client = GkeHubClient(
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_memberships), "__call__") as call:
Expand Down Expand Up @@ -696,8 +693,10 @@ def test_list_memberships_pager():
assert all(isinstance(i, membership.Membership) for i in results)


def test_list_memberships_pages():
client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials,)
def test_list_memberships_pages(transport_name: str = "grpc"):
client = GkeHubClient(
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_memberships), "__call__") as call:
Expand Down Expand Up @@ -796,9 +795,8 @@ async def test_list_memberships_async_pages():
assert page_.raw_page.next_page_token == token


def test_list_features(
transport: str = "grpc", request_type=service.ListFeaturesRequest
):
@pytest.mark.parametrize("request_type", [service.ListFeaturesRequest, dict,])
def test_list_features(request_type, transport: str = "grpc"):
client = GkeHubClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand All @@ -825,10 +823,6 @@ def test_list_features(
assert response.next_page_token == "next_page_token_value"


def test_list_features_from_dict():
test_list_features(request_type=dict)


def test_list_features_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 @@ -998,8 +992,10 @@ async def test_list_features_flattened_error_async():
)


def test_list_features_pager():
client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials,)
def test_list_features_pager(transport_name: str = "grpc"):
client = GkeHubClient(
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_features), "__call__") as call:
Expand Down Expand Up @@ -1032,8 +1028,10 @@ def test_list_features_pager():
assert all(isinstance(i, feature.Feature) for i in results)


def test_list_features_pages():
client = GkeHubClient(credentials=ga_credentials.AnonymousCredentials,)
def test_list_features_pages(transport_name: str = "grpc"):
client = GkeHubClient(
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_features), "__call__") as call:
Expand Down Expand Up @@ -1120,9 +1118,8 @@ async def test_list_features_async_pages():
assert page_.raw_page.next_page_token == token


def test_get_membership(
transport: str = "grpc", request_type=service.GetMembershipRequest
):
@pytest.mark.parametrize("request_type", [service.GetMembershipRequest, dict,])
def test_get_membership(request_type, transport: str = "grpc"):
client = GkeHubClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -1158,10 +1155,6 @@ def test_get_membership(
assert response.unique_id == "unique_id_value"


def test_get_membership_from_dict():
test_get_membership(request_type=dict)


def test_get_membership_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 @@ -1339,7 +1332,8 @@ async def test_get_membership_flattened_error_async():
)


def test_get_feature(transport: str = "grpc", request_type=service.GetFeatureRequest):
@pytest.mark.parametrize("request_type", [service.GetFeatureRequest, dict,])
def test_get_feature(request_type, transport: str = "grpc"):
client = GkeHubClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand All @@ -1364,10 +1358,6 @@ def test_get_feature(transport: str = "grpc", request_type=service.GetFeatureReq
assert response.name == "name_value"


def test_get_feature_from_dict():
test_get_feature(request_type=dict)


def test_get_feature_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 @@ -1533,9 +1523,8 @@ async def test_get_feature_flattened_error_async():
)


def test_create_membership(
transport: str = "grpc", request_type=service.CreateMembershipRequest
):
@pytest.mark.parametrize("request_type", [service.CreateMembershipRequest, dict,])
def test_create_membership(request_type, transport: str = "grpc"):
client = GkeHubClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand All @@ -1561,10 +1550,6 @@ def test_create_membership(
assert isinstance(response, future.Future)


def test_create_membership_from_dict():
test_create_membership(request_type=dict)


def test_create_membership_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 @@ -1803,9 +1788,8 @@ async def test_create_membership_flattened_error_async():
)


def test_create_feature(
transport: str = "grpc", request_type=service.CreateFeatureRequest
):
@pytest.mark.parametrize("request_type", [service.CreateFeatureRequest, dict,])
def test_create_feature(request_type, transport: str = "grpc"):
client = GkeHubClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand All @@ -1829,10 +1813,6 @@ def test_create_feature(
assert isinstance(response, future.Future)


def test_create_feature_from_dict():
test_create_feature(request_type=dict)


def test_create_feature_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 @@ -2027,9 +2007,8 @@ async def test_create_feature_flattened_error_async():
)


def test_delete_membership(
transport: str = "grpc", request_type=service.DeleteMembershipRequest
):
@pytest.mark.parametrize("request_type", [service.DeleteMembershipRequest, dict,])
def test_delete_membership(request_type, transport: str = "grpc"):
client = GkeHubClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand All @@ -2055,10 +2034,6 @@ def test_delete_membership(
assert isinstance(response, future.Future)


def test_delete_membership_from_dict():
test_delete_membership(request_type=dict)


def test_delete_membership_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 @@ -2239,9 +2214,8 @@ async def test_delete_membership_flattened_error_async():
)


def test_delete_feature(
transport: str = "grpc", request_type=service.DeleteFeatureRequest
):
@pytest.mark.parametrize("request_type", [service.DeleteFeatureRequest, dict,])
def test_delete_feature(request_type, transport: str = "grpc"):
client = GkeHubClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand All @@ -2265,10 +2239,6 @@ def test_delete_feature(
assert isinstance(response, future.Future)


def test_delete_feature_from_dict():
test_delete_feature(request_type=dict)


def test_delete_feature_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 @@ -2437,9 +2407,8 @@ async def test_delete_feature_flattened_error_async():
)


def test_update_membership(
transport: str = "grpc", request_type=service.UpdateMembershipRequest
):
@pytest.mark.parametrize("request_type", [service.UpdateMembershipRequest, dict,])
def test_update_membership(request_type, transport: str = "grpc"):
client = GkeHubClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand All @@ -2465,10 +2434,6 @@ def test_update_membership(
assert isinstance(response, future.Future)


def test_update_membership_from_dict():
test_update_membership(request_type=dict)


def test_update_membership_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 @@ -2707,9 +2672,8 @@ async def test_update_membership_flattened_error_async():
)


def test_update_feature(
transport: str = "grpc", request_type=service.UpdateFeatureRequest
):
@pytest.mark.parametrize("request_type", [service.UpdateFeatureRequest, dict,])
def test_update_feature(request_type, transport: str = "grpc"):
client = GkeHubClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand All @@ -2733,10 +2697,6 @@ def test_update_feature(
assert isinstance(response, future.Future)


def test_update_feature_from_dict():
test_update_feature(request_type=dict)


def test_update_feature_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 @@ -2931,9 +2891,10 @@ async def test_update_feature_flattened_error_async():
)


def test_generate_connect_manifest(
transport: str = "grpc", request_type=service.GenerateConnectManifestRequest
):
@pytest.mark.parametrize(
"request_type", [service.GenerateConnectManifestRequest, dict,]
)
def test_generate_connect_manifest(request_type, transport: str = "grpc"):
client = GkeHubClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand All @@ -2959,10 +2920,6 @@ def test_generate_connect_manifest(
assert isinstance(response, service.GenerateConnectManifestResponse)


def test_generate_connect_manifest_from_dict():
test_generate_connect_manifest(request_type=dict)


def test_generate_connect_manifest_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 @@ -3633,7 +3590,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
Loading

0 comments on commit 5e8c1e0

Please sign in to comment.