Skip to content

Commit

Permalink
chore: use gapic-generator-python 0.58.4 (#24)
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 11, 2022
1 parent cd87904 commit 93bb656
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 93 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 @@ -263,20 +263,20 @@ def test_cloud_filestore_manager_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 @@ -345,7 +345,7 @@ def test_cloud_filestore_manager_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 @@ -444,7 +444,7 @@ def test_cloud_filestore_manager_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 @@ -479,7 +479,7 @@ def test_cloud_filestore_manager_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 @@ -512,9 +512,10 @@ def test_cloud_filestore_manager_client_client_options_from_dict():
)


def test_list_instances(
transport: str = "grpc", request_type=cloud_filestore_service.ListInstancesRequest
):
@pytest.mark.parametrize(
"request_type", [cloud_filestore_service.ListInstancesRequest, dict,]
)
def test_list_instances(request_type, transport: str = "grpc"):
client = CloudFilestoreManagerClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -542,10 +543,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 @@ -732,9 +729,9 @@ async def test_list_instances_flattened_error_async():
)


def test_list_instances_pager():
def test_list_instances_pager(transport_name: str = "grpc"):
client = CloudFilestoreManagerClient(
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 @@ -777,9 +774,9 @@ def test_list_instances_pager():
assert all(isinstance(i, cloud_filestore_service.Instance) for i in results)


def test_list_instances_pages():
def test_list_instances_pages(transport_name: str = "grpc"):
client = CloudFilestoreManagerClient(
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 @@ -898,9 +895,10 @@ async def test_list_instances_async_pages():
assert page_.raw_page.next_page_token == token


def test_get_instance(
transport: str = "grpc", request_type=cloud_filestore_service.GetInstanceRequest
):
@pytest.mark.parametrize(
"request_type", [cloud_filestore_service.GetInstanceRequest, dict,]
)
def test_get_instance(request_type, transport: str = "grpc"):
client = CloudFilestoreManagerClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -937,10 +935,6 @@ def test_get_instance(
assert response.etag == "etag_value"


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 @@ -1135,9 +1129,10 @@ async def test_get_instance_flattened_error_async():
)


def test_create_instance(
transport: str = "grpc", request_type=cloud_filestore_service.CreateInstanceRequest
):
@pytest.mark.parametrize(
"request_type", [cloud_filestore_service.CreateInstanceRequest, dict,]
)
def test_create_instance(request_type, transport: str = "grpc"):
client = CloudFilestoreManagerClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand All @@ -1161,10 +1156,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 @@ -1372,9 +1363,10 @@ async def test_create_instance_flattened_error_async():
)


def test_update_instance(
transport: str = "grpc", request_type=cloud_filestore_service.UpdateInstanceRequest
):
@pytest.mark.parametrize(
"request_type", [cloud_filestore_service.UpdateInstanceRequest, dict,]
)
def test_update_instance(request_type, transport: str = "grpc"):
client = CloudFilestoreManagerClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand All @@ -1398,10 +1390,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 @@ -1603,9 +1591,10 @@ async def test_update_instance_flattened_error_async():
)


def test_restore_instance(
transport: str = "grpc", request_type=cloud_filestore_service.RestoreInstanceRequest
):
@pytest.mark.parametrize(
"request_type", [cloud_filestore_service.RestoreInstanceRequest, dict,]
)
def test_restore_instance(request_type, transport: str = "grpc"):
client = CloudFilestoreManagerClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand All @@ -1629,10 +1618,6 @@ def test_restore_instance(
assert isinstance(response, future.Future)


def test_restore_instance_from_dict():
test_restore_instance(request_type=dict)


def test_restore_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 @@ -1738,9 +1723,10 @@ async def test_restore_instance_field_headers_async():
assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]


def test_delete_instance(
transport: str = "grpc", request_type=cloud_filestore_service.DeleteInstanceRequest
):
@pytest.mark.parametrize(
"request_type", [cloud_filestore_service.DeleteInstanceRequest, dict,]
)
def test_delete_instance(request_type, transport: str = "grpc"):
client = CloudFilestoreManagerClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand All @@ -1764,10 +1750,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 @@ -1949,9 +1931,10 @@ async def test_delete_instance_flattened_error_async():
)


def test_list_backups(
transport: str = "grpc", request_type=cloud_filestore_service.ListBackupsRequest
):
@pytest.mark.parametrize(
"request_type", [cloud_filestore_service.ListBackupsRequest, dict,]
)
def test_list_backups(request_type, transport: str = "grpc"):
client = CloudFilestoreManagerClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -1979,10 +1962,6 @@ def test_list_backups(
assert response.unreachable == ["unreachable_value"]


def test_list_backups_from_dict():
test_list_backups(request_type=dict)


def test_list_backups_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 @@ -2169,9 +2148,9 @@ async def test_list_backups_flattened_error_async():
)


def test_list_backups_pager():
def test_list_backups_pager(transport_name: str = "grpc"):
client = CloudFilestoreManagerClient(
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 @@ -2214,9 +2193,9 @@ def test_list_backups_pager():
assert all(isinstance(i, cloud_filestore_service.Backup) for i in results)


def test_list_backups_pages():
def test_list_backups_pages(transport_name: str = "grpc"):
client = CloudFilestoreManagerClient(
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 @@ -2335,9 +2314,10 @@ async def test_list_backups_async_pages():
assert page_.raw_page.next_page_token == token


def test_get_backup(
transport: str = "grpc", request_type=cloud_filestore_service.GetBackupRequest
):
@pytest.mark.parametrize(
"request_type", [cloud_filestore_service.GetBackupRequest, dict,]
)
def test_get_backup(request_type, transport: str = "grpc"):
client = CloudFilestoreManagerClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -2382,10 +2362,6 @@ def test_get_backup(
assert response.download_bytes == 1502


def test_get_backup_from_dict():
test_get_backup(request_type=dict)


def test_get_backup_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 @@ -2588,9 +2564,10 @@ async def test_get_backup_flattened_error_async():
)


def test_create_backup(
transport: str = "grpc", request_type=cloud_filestore_service.CreateBackupRequest
):
@pytest.mark.parametrize(
"request_type", [cloud_filestore_service.CreateBackupRequest, dict,]
)
def test_create_backup(request_type, transport: str = "grpc"):
client = CloudFilestoreManagerClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand All @@ -2614,10 +2591,6 @@ def test_create_backup(
assert isinstance(response, future.Future)


def test_create_backup_from_dict():
test_create_backup(request_type=dict)


def test_create_backup_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 @@ -2825,9 +2798,10 @@ async def test_create_backup_flattened_error_async():
)


def test_delete_backup(
transport: str = "grpc", request_type=cloud_filestore_service.DeleteBackupRequest
):
@pytest.mark.parametrize(
"request_type", [cloud_filestore_service.DeleteBackupRequest, dict,]
)
def test_delete_backup(request_type, transport: str = "grpc"):
client = CloudFilestoreManagerClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand All @@ -2851,10 +2825,6 @@ def test_delete_backup(
assert isinstance(response, future.Future)


def test_delete_backup_from_dict():
test_delete_backup(request_type=dict)


def test_delete_backup_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 @@ -3036,9 +3006,10 @@ async def test_delete_backup_flattened_error_async():
)


def test_update_backup(
transport: str = "grpc", request_type=cloud_filestore_service.UpdateBackupRequest
):
@pytest.mark.parametrize(
"request_type", [cloud_filestore_service.UpdateBackupRequest, dict,]
)
def test_update_backup(request_type, transport: str = "grpc"):
client = CloudFilestoreManagerClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand All @@ -3062,10 +3033,6 @@ def test_update_backup(
assert isinstance(response, future.Future)


def test_update_backup_from_dict():
test_update_backup(request_type=dict)


def test_update_backup_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 @@ -3846,7 +3813,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 93bb656

Please sign in to comment.