Skip to content

Commit

Permalink
chore: use gapic-generator-python 0.58.4 (#103)
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 7, 2022
1 parent 02f6376 commit cabb43b
Show file tree
Hide file tree
Showing 10 changed files with 79 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 @@ -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 @@ -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 @@ -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 @@ -269,20 +269,20 @@ def test_binauthz_management_service_v1_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 @@ -351,7 +351,7 @@ def test_binauthz_management_service_v1_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 @@ -450,7 +450,7 @@ def test_binauthz_management_service_v1_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 @@ -485,7 +485,7 @@ def test_binauthz_management_service_v1_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 @@ -518,7 +518,8 @@ def test_binauthz_management_service_v1_client_client_options_from_dict():
)


def test_get_policy(transport: str = "grpc", request_type=service.GetPolicyRequest):
@pytest.mark.parametrize("request_type", [service.GetPolicyRequest, dict,])
def test_get_policy(request_type, transport: str = "grpc"):
client = BinauthzManagementServiceV1Client(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -552,10 +553,6 @@ def test_get_policy(transport: str = "grpc", request_type=service.GetPolicyReque
)


def test_get_policy_from_dict():
test_get_policy(request_type=dict)


def test_get_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 @@ -742,9 +739,8 @@ async def test_get_policy_flattened_error_async():
)


def test_update_policy(
transport: str = "grpc", request_type=service.UpdatePolicyRequest
):
@pytest.mark.parametrize("request_type", [service.UpdatePolicyRequest, dict,])
def test_update_policy(request_type, transport: str = "grpc"):
client = BinauthzManagementServiceV1Client(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -778,10 +774,6 @@ def test_update_policy(
)


def test_update_policy_from_dict():
test_update_policy(request_type=dict)


def test_update_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 @@ -970,9 +962,8 @@ async def test_update_policy_flattened_error_async():
)


def test_create_attestor(
transport: str = "grpc", request_type=service.CreateAttestorRequest
):
@pytest.mark.parametrize("request_type", [service.CreateAttestorRequest, dict,])
def test_create_attestor(request_type, transport: str = "grpc"):
client = BinauthzManagementServiceV1Client(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -1004,10 +995,6 @@ def test_create_attestor(
assert response.description == "description_value"


def test_create_attestor_from_dict():
test_create_attestor(request_type=dict)


def test_create_attestor_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 @@ -1212,7 +1199,8 @@ async def test_create_attestor_flattened_error_async():
)


def test_get_attestor(transport: str = "grpc", request_type=service.GetAttestorRequest):
@pytest.mark.parametrize("request_type", [service.GetAttestorRequest, dict,])
def test_get_attestor(request_type, transport: str = "grpc"):
client = BinauthzManagementServiceV1Client(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -1244,10 +1232,6 @@ def test_get_attestor(transport: str = "grpc", request_type=service.GetAttestorR
assert response.description == "description_value"


def test_get_attestor_from_dict():
test_get_attestor(request_type=dict)


def test_get_attestor_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 @@ -1426,9 +1410,8 @@ async def test_get_attestor_flattened_error_async():
)


def test_update_attestor(
transport: str = "grpc", request_type=service.UpdateAttestorRequest
):
@pytest.mark.parametrize("request_type", [service.UpdateAttestorRequest, dict,])
def test_update_attestor(request_type, transport: str = "grpc"):
client = BinauthzManagementServiceV1Client(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -1460,10 +1443,6 @@ def test_update_attestor(
assert response.description == "description_value"


def test_update_attestor_from_dict():
test_update_attestor(request_type=dict)


def test_update_attestor_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 @@ -1650,9 +1629,8 @@ async def test_update_attestor_flattened_error_async():
)


def test_list_attestors(
transport: str = "grpc", request_type=service.ListAttestorsRequest
):
@pytest.mark.parametrize("request_type", [service.ListAttestorsRequest, dict,])
def test_list_attestors(request_type, transport: str = "grpc"):
client = BinauthzManagementServiceV1Client(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand All @@ -1679,10 +1657,6 @@ def test_list_attestors(
assert response.next_page_token == "next_page_token_value"


def test_list_attestors_from_dict():
test_list_attestors(request_type=dict)


def test_list_attestors_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 @@ -1864,9 +1838,9 @@ async def test_list_attestors_flattened_error_async():
)


def test_list_attestors_pager():
def test_list_attestors_pager(transport_name: str = "grpc"):
client = BinauthzManagementServiceV1Client(
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 @@ -1904,9 +1878,9 @@ def test_list_attestors_pager():
assert all(isinstance(i, resources.Attestor) for i in results)


def test_list_attestors_pages():
def test_list_attestors_pages(transport_name: str = "grpc"):
client = BinauthzManagementServiceV1Client(
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 @@ -2010,9 +1984,8 @@ async def test_list_attestors_async_pages():
assert page_.raw_page.next_page_token == token


def test_delete_attestor(
transport: str = "grpc", request_type=service.DeleteAttestorRequest
):
@pytest.mark.parametrize("request_type", [service.DeleteAttestorRequest, dict,])
def test_delete_attestor(request_type, transport: str = "grpc"):
client = BinauthzManagementServiceV1Client(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand All @@ -2036,10 +2009,6 @@ def test_delete_attestor(
assert response is None


def test_delete_attestor_from_dict():
test_delete_attestor(request_type=dict)


def test_delete_attestor_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 @@ -2765,7 +2734,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
Original file line number Diff line number Diff line change
Expand Up @@ -251,20 +251,20 @@ def test_system_policy_v1_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 @@ -323,7 +323,7 @@ def test_system_policy_v1_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 @@ -418,7 +418,7 @@ def test_system_policy_v1_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 @@ -449,7 +449,7 @@ def test_system_policy_v1_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 @@ -482,9 +482,8 @@ def test_system_policy_v1_client_client_options_from_dict():
)


def test_get_system_policy(
transport: str = "grpc", request_type=service.GetSystemPolicyRequest
):
@pytest.mark.parametrize("request_type", [service.GetSystemPolicyRequest, dict,])
def test_get_system_policy(request_type, transport: str = "grpc"):
client = SystemPolicyV1Client(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -520,10 +519,6 @@ def test_get_system_policy(
)


def test_get_system_policy_from_dict():
test_get_system_policy(request_type=dict)


def test_get_system_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 @@ -1222,7 +1217,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 cabb43b

Please sign in to comment.