Skip to content

Commit

Permalink
chore: use gapic-generator-python 0.58.4 (#171)
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 f4e2bda commit 06e1426
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 57 deletions.
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 @@ -251,20 +251,20 @@ def test_beta_analytics_data_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 @@ -333,7 +333,7 @@ def test_beta_analytics_data_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 @@ -428,7 +428,7 @@ def test_beta_analytics_data_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 @@ -459,7 +459,7 @@ def test_beta_analytics_data_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 @@ -492,9 +492,8 @@ def test_beta_analytics_data_client_client_options_from_dict():
)


def test_run_report(
transport: str = "grpc", request_type=analytics_data_api.RunReportRequest
):
@pytest.mark.parametrize("request_type", [analytics_data_api.RunReportRequest, dict,])
def test_run_report(request_type, transport: str = "grpc"):
client = BetaAnalyticsDataClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -522,10 +521,6 @@ def test_run_report(
assert response.kind == "kind_value"


def test_run_report_from_dict():
test_run_report(request_type=dict)


def test_run_report_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 @@ -630,9 +625,10 @@ async def test_run_report_field_headers_async():
assert ("x-goog-request-params", "property=property/value",) in kw["metadata"]


def test_run_pivot_report(
transport: str = "grpc", request_type=analytics_data_api.RunPivotReportRequest
):
@pytest.mark.parametrize(
"request_type", [analytics_data_api.RunPivotReportRequest, dict,]
)
def test_run_pivot_report(request_type, transport: str = "grpc"):
client = BetaAnalyticsDataClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand All @@ -659,10 +655,6 @@ def test_run_pivot_report(
assert response.kind == "kind_value"


def test_run_pivot_report_from_dict():
test_run_pivot_report(request_type=dict)


def test_run_pivot_report_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 @@ -767,9 +759,10 @@ async def test_run_pivot_report_field_headers_async():
assert ("x-goog-request-params", "property=property/value",) in kw["metadata"]


def test_batch_run_reports(
transport: str = "grpc", request_type=analytics_data_api.BatchRunReportsRequest
):
@pytest.mark.parametrize(
"request_type", [analytics_data_api.BatchRunReportsRequest, dict,]
)
def test_batch_run_reports(request_type, transport: str = "grpc"):
client = BetaAnalyticsDataClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -798,10 +791,6 @@ def test_batch_run_reports(
assert response.kind == "kind_value"


def test_batch_run_reports_from_dict():
test_batch_run_reports(request_type=dict)


def test_batch_run_reports_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 @@ -914,9 +903,10 @@ async def test_batch_run_reports_field_headers_async():
assert ("x-goog-request-params", "property=property/value",) in kw["metadata"]


def test_batch_run_pivot_reports(
transport: str = "grpc", request_type=analytics_data_api.BatchRunPivotReportsRequest
):
@pytest.mark.parametrize(
"request_type", [analytics_data_api.BatchRunPivotReportsRequest, dict,]
)
def test_batch_run_pivot_reports(request_type, transport: str = "grpc"):
client = BetaAnalyticsDataClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -945,10 +935,6 @@ def test_batch_run_pivot_reports(
assert response.kind == "kind_value"


def test_batch_run_pivot_reports_from_dict():
test_batch_run_pivot_reports(request_type=dict)


def test_batch_run_pivot_reports_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 @@ -1061,9 +1047,8 @@ async def test_batch_run_pivot_reports_field_headers_async():
assert ("x-goog-request-params", "property=property/value",) in kw["metadata"]


def test_get_metadata(
transport: str = "grpc", request_type=analytics_data_api.GetMetadataRequest
):
@pytest.mark.parametrize("request_type", [analytics_data_api.GetMetadataRequest, dict,])
def test_get_metadata(request_type, transport: str = "grpc"):
client = BetaAnalyticsDataClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand All @@ -1088,10 +1073,6 @@ def test_get_metadata(
assert response.name == "name_value"


def test_get_metadata_from_dict():
test_get_metadata(request_type=dict)


def test_get_metadata_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 @@ -1267,9 +1248,10 @@ async def test_get_metadata_flattened_error_async():
)


def test_run_realtime_report(
transport: str = "grpc", request_type=analytics_data_api.RunRealtimeReportRequest
):
@pytest.mark.parametrize(
"request_type", [analytics_data_api.RunRealtimeReportRequest, dict,]
)
def test_run_realtime_report(request_type, transport: str = "grpc"):
client = BetaAnalyticsDataClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand Down Expand Up @@ -1299,10 +1281,6 @@ def test_run_realtime_report(
assert response.kind == "kind_value"


def test_run_realtime_report_from_dict():
test_run_realtime_report(request_type=dict)


def test_run_realtime_report_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 @@ -1418,9 +1396,10 @@ async def test_run_realtime_report_field_headers_async():
assert ("x-goog-request-params", "property=property/value",) in kw["metadata"]


def test_check_compatibility(
transport: str = "grpc", request_type=analytics_data_api.CheckCompatibilityRequest
):
@pytest.mark.parametrize(
"request_type", [analytics_data_api.CheckCompatibilityRequest, dict,]
)
def test_check_compatibility(request_type, transport: str = "grpc"):
client = BetaAnalyticsDataClient(
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
Expand All @@ -1446,10 +1425,6 @@ def test_check_compatibility(
assert isinstance(response, analytics_data_api.CheckCompatibilityResponse)


def test_check_compatibility_from_dict():
test_check_compatibility(request_type=dict)


def test_check_compatibility_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 @@ -2089,7 +2064,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 06e1426

Please sign in to comment.