Skip to content

Commit

Permalink
chore: use gapic-generator-python 0.58.4 (#60)
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 8, 2022
1 parent 89ea15f commit 1558e75
Show file tree
Hide file tree
Showing 12 changed files with 122 additions and 184 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,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 @@ -107,7 +107,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 @@ -106,7 +106,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 @@ -106,7 +106,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 @@ -106,7 +106,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 @@ -107,7 +107,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 @@ -256,20 +256,20 @@ def test_flex_templates_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 @@ -338,7 +338,7 @@ def test_flex_templates_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 @@ -437,7 +437,7 @@ def test_flex_templates_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 @@ -472,7 +472,7 @@ def test_flex_templates_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 @@ -505,9 +505,8 @@ def test_flex_templates_service_client_client_options_from_dict():
)


def test_launch_flex_template(
transport: str = "grpc", request_type=templates.LaunchFlexTemplateRequest
):
@pytest.mark.parametrize("request_type", [templates.LaunchFlexTemplateRequest, dict,])
def test_launch_flex_template(request_type, transport: str = "grpc"):
client = FlexTemplatesServiceClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand All @@ -533,10 +532,6 @@ def test_launch_flex_template(
assert isinstance(response, templates.LaunchFlexTemplateResponse)


def test_launch_flex_template_from_dict():
test_launch_flex_template(request_type=dict)


def test_launch_flex_template_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 @@ -1102,7 +1097,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 @@ -243,20 +243,20 @@ def test_jobs_v1_beta3_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 @@ -313,7 +313,7 @@ def test_jobs_v1_beta3_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 @@ -408,7 +408,7 @@ def test_jobs_v1_beta3_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 @@ -439,7 +439,7 @@ def test_jobs_v1_beta3_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 @@ -470,7 +470,8 @@ def test_jobs_v1_beta3_client_client_options_from_dict():
)


def test_create_job(transport: str = "grpc", request_type=jobs.CreateJobRequest):
@pytest.mark.parametrize("request_type", [jobs.CreateJobRequest, dict,])
def test_create_job(request_type, transport: str = "grpc"):
client = JobsV1Beta3Client(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -523,10 +524,6 @@ def test_create_job(transport: str = "grpc", request_type=jobs.CreateJobRequest)
assert response.satisfies_pzs is True


def test_create_job_from_dict():
test_create_job(request_type=dict)


def test_create_job_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 @@ -605,7 +602,8 @@ async def test_create_job_async_from_dict():
await test_create_job_async(request_type=dict)


def test_get_job(transport: str = "grpc", request_type=jobs.GetJobRequest):
@pytest.mark.parametrize("request_type", [jobs.GetJobRequest, dict,])
def test_get_job(request_type, transport: str = "grpc"):
client = JobsV1Beta3Client(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -658,10 +656,6 @@ def test_get_job(transport: str = "grpc", request_type=jobs.GetJobRequest):
assert response.satisfies_pzs is True


def test_get_job_from_dict():
test_get_job(request_type=dict)


def test_get_job_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 @@ -740,7 +734,8 @@ async def test_get_job_async_from_dict():
await test_get_job_async(request_type=dict)


def test_update_job(transport: str = "grpc", request_type=jobs.UpdateJobRequest):
@pytest.mark.parametrize("request_type", [jobs.UpdateJobRequest, dict,])
def test_update_job(request_type, transport: str = "grpc"):
client = JobsV1Beta3Client(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -793,10 +788,6 @@ def test_update_job(transport: str = "grpc", request_type=jobs.UpdateJobRequest)
assert response.satisfies_pzs is True


def test_update_job_from_dict():
test_update_job(request_type=dict)


def test_update_job_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 @@ -875,7 +866,8 @@ async def test_update_job_async_from_dict():
await test_update_job_async(request_type=dict)


def test_list_jobs(transport: str = "grpc", request_type=jobs.ListJobsRequest):
@pytest.mark.parametrize("request_type", [jobs.ListJobsRequest, dict,])
def test_list_jobs(request_type, transport: str = "grpc"):
client = JobsV1Beta3Client(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand All @@ -902,10 +894,6 @@ def test_list_jobs(transport: str = "grpc", request_type=jobs.ListJobsRequest):
assert response.next_page_token == "next_page_token_value"


def test_list_jobs_from_dict():
test_list_jobs(request_type=dict)


def test_list_jobs_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 @@ -956,8 +944,10 @@ async def test_list_jobs_async_from_dict():
await test_list_jobs_async(request_type=dict)


def test_list_jobs_pager():
client = JobsV1Beta3Client(credentials=ga_credentials.AnonymousCredentials,)
def test_list_jobs_pager(transport_name: str = "grpc"):
client = JobsV1Beta3Client(
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_jobs), "__call__") as call:
Expand All @@ -982,8 +972,10 @@ def test_list_jobs_pager():
assert all(isinstance(i, jobs.Job) for i in results)


def test_list_jobs_pages():
client = JobsV1Beta3Client(credentials=ga_credentials.AnonymousCredentials,)
def test_list_jobs_pages(transport_name: str = "grpc"):
client = JobsV1Beta3Client(
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_jobs), "__call__") as call:
Expand Down Expand Up @@ -1055,9 +1047,8 @@ async def test_list_jobs_async_pages():
assert page_.raw_page.next_page_token == token


def test_aggregated_list_jobs(
transport: str = "grpc", request_type=jobs.ListJobsRequest
):
@pytest.mark.parametrize("request_type", [jobs.ListJobsRequest, dict,])
def test_aggregated_list_jobs(request_type, transport: str = "grpc"):
client = JobsV1Beta3Client(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -1086,10 +1077,6 @@ def test_aggregated_list_jobs(
assert response.next_page_token == "next_page_token_value"


def test_aggregated_list_jobs_from_dict():
test_aggregated_list_jobs(request_type=dict)


def test_aggregated_list_jobs_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 @@ -1144,8 +1131,10 @@ async def test_aggregated_list_jobs_async_from_dict():
await test_aggregated_list_jobs_async(request_type=dict)


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

# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
Expand All @@ -1172,8 +1161,10 @@ def test_aggregated_list_jobs_pager():
assert all(isinstance(i, jobs.Job) for i in results)


def test_aggregated_list_jobs_pages():
client = JobsV1Beta3Client(credentials=ga_credentials.AnonymousCredentials,)
def test_aggregated_list_jobs_pages(transport_name: str = "grpc"):
client = JobsV1Beta3Client(
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 @@ -1251,9 +1242,8 @@ async def test_aggregated_list_jobs_async_pages():
assert page_.raw_page.next_page_token == token


def test_check_active_jobs(
transport: str = "grpc", request_type=jobs.CheckActiveJobsRequest
):
@pytest.mark.parametrize("request_type", [jobs.CheckActiveJobsRequest, dict,])
def test_check_active_jobs(request_type, transport: str = "grpc"):
client = JobsV1Beta3Client(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand All @@ -1280,10 +1270,6 @@ def test_check_active_jobs(
assert response.active_jobs_exist is True


def test_check_active_jobs_from_dict():
test_check_active_jobs(request_type=dict)


def test_check_active_jobs_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 @@ -1338,7 +1324,8 @@ async def test_check_active_jobs_async_from_dict():
await test_check_active_jobs_async(request_type=dict)


def test_snapshot_job(transport: str = "grpc", request_type=jobs.SnapshotJobRequest):
@pytest.mark.parametrize("request_type", [jobs.SnapshotJobRequest, dict,])
def test_snapshot_job(request_type, transport: str = "grpc"):
client = JobsV1Beta3Client(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -1377,10 +1364,6 @@ def test_snapshot_job(transport: str = "grpc", request_type=jobs.SnapshotJobRequ
assert response.region == "region_value"


def test_snapshot_job_from_dict():
test_snapshot_job(request_type=dict)


def test_snapshot_job_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 @@ -1944,7 +1927,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 1558e75

Please sign in to comment.