Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

chore: use gapic-generator-python 0.58.4 #316

Merged
merged 2 commits into from
Jan 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,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 @@ -102,7 +102,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 @@ -102,7 +102,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 @@ -102,7 +102,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
82 changes: 31 additions & 51 deletions tests/unit/gapic/dataproc_v1/test_autoscaling_policy_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,20 +262,20 @@ def test_autoscaling_policy_service_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 @@ -344,7 +344,7 @@ def test_autoscaling_policy_service_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 @@ -443,7 +443,7 @@ def test_autoscaling_policy_service_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 @@ -478,7 +478,7 @@ def test_autoscaling_policy_service_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 @@ -511,10 +511,10 @@ def test_autoscaling_policy_service_client_client_options_from_dict():
)


def test_create_autoscaling_policy(
transport: str = "grpc",
request_type=autoscaling_policies.CreateAutoscalingPolicyRequest,
):
@pytest.mark.parametrize(
"request_type", [autoscaling_policies.CreateAutoscalingPolicyRequest, dict,]
)
def test_create_autoscaling_policy(request_type, transport: str = "grpc"):
client = AutoscalingPolicyServiceClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -550,10 +550,6 @@ def test_create_autoscaling_policy(
assert response.name == "name_value"


def test_create_autoscaling_policy_from_dict():
test_create_autoscaling_policy(request_type=dict)


def test_create_autoscaling_policy_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 @@ -765,10 +761,10 @@ async def test_create_autoscaling_policy_flattened_error_async():
)


def test_update_autoscaling_policy(
transport: str = "grpc",
request_type=autoscaling_policies.UpdateAutoscalingPolicyRequest,
):
@pytest.mark.parametrize(
"request_type", [autoscaling_policies.UpdateAutoscalingPolicyRequest, dict,]
)
def test_update_autoscaling_policy(request_type, transport: str = "grpc"):
client = AutoscalingPolicyServiceClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -804,10 +800,6 @@ def test_update_autoscaling_policy(
assert response.name == "name_value"


def test_update_autoscaling_policy_from_dict():
test_update_autoscaling_policy(request_type=dict)


def test_update_autoscaling_policy_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 @@ -1009,10 +1001,10 @@ async def test_update_autoscaling_policy_flattened_error_async():
)


def test_get_autoscaling_policy(
transport: str = "grpc",
request_type=autoscaling_policies.GetAutoscalingPolicyRequest,
):
@pytest.mark.parametrize(
"request_type", [autoscaling_policies.GetAutoscalingPolicyRequest, dict,]
)
def test_get_autoscaling_policy(request_type, transport: str = "grpc"):
client = AutoscalingPolicyServiceClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -1048,10 +1040,6 @@ def test_get_autoscaling_policy(
assert response.name == "name_value"


def test_get_autoscaling_policy_from_dict():
test_get_autoscaling_policy(request_type=dict)


def test_get_autoscaling_policy_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 @@ -1247,10 +1235,10 @@ async def test_get_autoscaling_policy_flattened_error_async():
)


def test_list_autoscaling_policies(
transport: str = "grpc",
request_type=autoscaling_policies.ListAutoscalingPoliciesRequest,
):
@pytest.mark.parametrize(
"request_type", [autoscaling_policies.ListAutoscalingPoliciesRequest, dict,]
)
def test_list_autoscaling_policies(request_type, transport: str = "grpc"):
client = AutoscalingPolicyServiceClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -1279,10 +1267,6 @@ def test_list_autoscaling_policies(
assert response.next_page_token == "next_page_token_value"


def test_list_autoscaling_policies_from_dict():
test_list_autoscaling_policies(request_type=dict)


def test_list_autoscaling_policies_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 @@ -1481,9 +1465,9 @@ async def test_list_autoscaling_policies_flattened_error_async():
)


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

# Mock the actual call within the gRPC stub, and fake the request.
Expand Down Expand Up @@ -1531,9 +1515,9 @@ def test_list_autoscaling_policies_pager():
)


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

# Mock the actual call within the gRPC stub, and fake the request.
Expand Down Expand Up @@ -1663,10 +1647,10 @@ async def test_list_autoscaling_policies_async_pages():
assert page_.raw_page.next_page_token == token


def test_delete_autoscaling_policy(
transport: str = "grpc",
request_type=autoscaling_policies.DeleteAutoscalingPolicyRequest,
):
@pytest.mark.parametrize(
"request_type", [autoscaling_policies.DeleteAutoscalingPolicyRequest, dict,]
)
def test_delete_autoscaling_policy(request_type, transport: str = "grpc"):
client = AutoscalingPolicyServiceClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand All @@ -1692,10 +1676,6 @@ def test_delete_autoscaling_policy(
assert response is None


def test_delete_autoscaling_policy_from_dict():
test_delete_autoscaling_policy(request_type=dict)


def test_delete_autoscaling_policy_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 @@ -2411,7 +2391,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