Skip to content

Commit

Permalink
chore: use gapic-generator-python 0.58.4 (#140)
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 <[email protected]>
  • Loading branch information
3 people authored Jan 7, 2022
1 parent acbd40f commit 5b30368
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 114 deletions.
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 @@ -99,7 +99,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 @@ -242,20 +242,20 @@ def test_cloud_billing_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 @@ -312,7 +312,7 @@ def test_cloud_billing_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 @@ -407,7 +407,7 @@ def test_cloud_billing_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 @@ -438,7 +438,7 @@ def test_cloud_billing_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 @@ -469,9 +469,10 @@ def test_cloud_billing_client_client_options_from_dict():
)


def test_get_billing_account(
transport: str = "grpc", request_type=cloud_billing.GetBillingAccountRequest
):
@pytest.mark.parametrize(
"request_type", [cloud_billing.GetBillingAccountRequest, dict,]
)
def test_get_billing_account(request_type, transport: str = "grpc"):
client = CloudBillingClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -506,10 +507,6 @@ def test_get_billing_account(
assert response.master_billing_account == "master_billing_account_value"


def test_get_billing_account_from_dict():
test_get_billing_account(request_type=dict)


def test_get_billing_account_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 @@ -699,9 +696,10 @@ async def test_get_billing_account_flattened_error_async():
)


def test_list_billing_accounts(
transport: str = "grpc", request_type=cloud_billing.ListBillingAccountsRequest
):
@pytest.mark.parametrize(
"request_type", [cloud_billing.ListBillingAccountsRequest, dict,]
)
def test_list_billing_accounts(request_type, transport: str = "grpc"):
client = CloudBillingClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -730,10 +728,6 @@ def test_list_billing_accounts(
assert response.next_page_token == "next_page_token_value"


def test_list_billing_accounts_from_dict():
test_list_billing_accounts(request_type=dict)


def test_list_billing_accounts_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 @@ -791,8 +785,10 @@ async def test_list_billing_accounts_async_from_dict():
await test_list_billing_accounts_async(request_type=dict)


def test_list_billing_accounts_pager():
client = CloudBillingClient(credentials=ga_credentials.AnonymousCredentials,)
def test_list_billing_accounts_pager(transport_name: str = "grpc"):
client = CloudBillingClient(
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 @@ -834,8 +830,10 @@ def test_list_billing_accounts_pager():
assert all(isinstance(i, cloud_billing.BillingAccount) for i in results)


def test_list_billing_accounts_pages():
client = CloudBillingClient(credentials=ga_credentials.AnonymousCredentials,)
def test_list_billing_accounts_pages(transport_name: str = "grpc"):
client = CloudBillingClient(
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 @@ -958,9 +956,10 @@ async def test_list_billing_accounts_async_pages():
assert page_.raw_page.next_page_token == token


def test_update_billing_account(
transport: str = "grpc", request_type=cloud_billing.UpdateBillingAccountRequest
):
@pytest.mark.parametrize(
"request_type", [cloud_billing.UpdateBillingAccountRequest, dict,]
)
def test_update_billing_account(request_type, transport: str = "grpc"):
client = CloudBillingClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -995,10 +994,6 @@ def test_update_billing_account(
assert response.master_billing_account == "master_billing_account_value"


def test_update_billing_account_from_dict():
test_update_billing_account(request_type=dict)


def test_update_billing_account_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 @@ -1203,9 +1198,10 @@ async def test_update_billing_account_flattened_error_async():
)


def test_create_billing_account(
transport: str = "grpc", request_type=cloud_billing.CreateBillingAccountRequest
):
@pytest.mark.parametrize(
"request_type", [cloud_billing.CreateBillingAccountRequest, dict,]
)
def test_create_billing_account(request_type, transport: str = "grpc"):
client = CloudBillingClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -1240,10 +1236,6 @@ def test_create_billing_account(
assert response.master_billing_account == "master_billing_account_value"


def test_create_billing_account_from_dict():
test_create_billing_account(request_type=dict)


def test_create_billing_account_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 @@ -1385,9 +1377,10 @@ async def test_create_billing_account_flattened_error_async():
)


def test_list_project_billing_info(
transport: str = "grpc", request_type=cloud_billing.ListProjectBillingInfoRequest
):
@pytest.mark.parametrize(
"request_type", [cloud_billing.ListProjectBillingInfoRequest, dict,]
)
def test_list_project_billing_info(request_type, transport: str = "grpc"):
client = CloudBillingClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -1416,10 +1409,6 @@ def test_list_project_billing_info(
assert response.next_page_token == "next_page_token_value"


def test_list_project_billing_info_from_dict():
test_list_project_billing_info(request_type=dict)


def test_list_project_billing_info_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 @@ -1604,8 +1593,10 @@ async def test_list_project_billing_info_flattened_error_async():
)


def test_list_project_billing_info_pager():
client = CloudBillingClient(credentials=ga_credentials.AnonymousCredentials,)
def test_list_project_billing_info_pager(transport_name: str = "grpc"):
client = CloudBillingClient(
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 @@ -1650,8 +1641,10 @@ def test_list_project_billing_info_pager():
assert all(isinstance(i, cloud_billing.ProjectBillingInfo) for i in results)


def test_list_project_billing_info_pages():
client = CloudBillingClient(credentials=ga_credentials.AnonymousCredentials,)
def test_list_project_billing_info_pages(transport_name: str = "grpc"):
client = CloudBillingClient(
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 @@ -1774,9 +1767,10 @@ async def test_list_project_billing_info_async_pages():
assert page_.raw_page.next_page_token == token


def test_get_project_billing_info(
transport: str = "grpc", request_type=cloud_billing.GetProjectBillingInfoRequest
):
@pytest.mark.parametrize(
"request_type", [cloud_billing.GetProjectBillingInfoRequest, dict,]
)
def test_get_project_billing_info(request_type, transport: str = "grpc"):
client = CloudBillingClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -1811,10 +1805,6 @@ def test_get_project_billing_info(
assert response.billing_enabled is True


def test_get_project_billing_info_from_dict():
test_get_project_billing_info(request_type=dict)


def test_get_project_billing_info_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 @@ -2005,9 +1995,10 @@ async def test_get_project_billing_info_flattened_error_async():
)


def test_update_project_billing_info(
transport: str = "grpc", request_type=cloud_billing.UpdateProjectBillingInfoRequest
):
@pytest.mark.parametrize(
"request_type", [cloud_billing.UpdateProjectBillingInfoRequest, dict,]
)
def test_update_project_billing_info(request_type, transport: str = "grpc"):
client = CloudBillingClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -2042,10 +2033,6 @@ def test_update_project_billing_info(
assert response.billing_enabled is True


def test_update_project_billing_info_from_dict():
test_update_project_billing_info(request_type=dict)


def test_update_project_billing_info_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 @@ -2252,9 +2239,8 @@ async def test_update_project_billing_info_flattened_error_async():
)


def test_get_iam_policy(
transport: str = "grpc", request_type=iam_policy_pb2.GetIamPolicyRequest
):
@pytest.mark.parametrize("request_type", [iam_policy_pb2.GetIamPolicyRequest, dict,])
def test_get_iam_policy(request_type, transport: str = "grpc"):
client = CloudBillingClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand All @@ -2280,10 +2266,6 @@ def test_get_iam_policy(
assert response.etag == b"etag_blob"


def test_get_iam_policy_from_dict():
test_get_iam_policy(request_type=dict)


def test_get_iam_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 @@ -2465,9 +2447,8 @@ async def test_get_iam_policy_flattened_error_async():
)


def test_set_iam_policy(
transport: str = "grpc", request_type=iam_policy_pb2.SetIamPolicyRequest
):
@pytest.mark.parametrize("request_type", [iam_policy_pb2.SetIamPolicyRequest, dict,])
def test_set_iam_policy(request_type, transport: str = "grpc"):
client = CloudBillingClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand All @@ -2493,10 +2474,6 @@ def test_set_iam_policy(
assert response.etag == b"etag_blob"


def test_set_iam_policy_from_dict():
test_set_iam_policy(request_type=dict)


def test_set_iam_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 @@ -2678,9 +2655,10 @@ async def test_set_iam_policy_flattened_error_async():
)


def test_test_iam_permissions(
transport: str = "grpc", request_type=iam_policy_pb2.TestIamPermissionsRequest
):
@pytest.mark.parametrize(
"request_type", [iam_policy_pb2.TestIamPermissionsRequest, dict,]
)
def test_test_iam_permissions(request_type, transport: str = "grpc"):
client = CloudBillingClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -2709,10 +2687,6 @@ def test_test_iam_permissions(
assert response.permissions == ["permissions_value"]


def test_test_iam_permissions_from_dict():
test_test_iam_permissions(request_type=dict)


def test_test_iam_permissions_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 @@ -3416,7 +3390,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 5b30368

Please sign in to comment.