Skip to content

Commit

Permalink
chore: Update gapic-generator-python to v1.11.8 (#393)
Browse files Browse the repository at this point in the history
* chore: Update gapic-generator-python to v1.11.7

PiperOrigin-RevId: 573230664

Source-Link: googleapis/googleapis@93beed3

Source-Link: googleapis/googleapis-gen@f4a4eda
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZjRhNGVkYWE4MDU3NjM5ZmNmNmFkZjkxNzk4NzIyODBkMWE4ZjY1MSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* chore: Update gapic-generator-python to v1.11.8

PiperOrigin-RevId: 574178735

Source-Link: googleapis/googleapis@7307199

Source-Link: googleapis/googleapis-gen@ce3af21
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2UzYWYyMWI3YzU1OWE4N2MyYmVmYzA3NmJlMGUzYWVkYTNhMjZmMCJ9

* 🦉 Updates from OwlBot post-processor

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>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Oct 18, 2023
1 parent 38e6598 commit 030f315
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-analytics-data",
"version": "0.17.2"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-analytics-data",
"version": "0.17.2"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2137,8 +2137,9 @@ def test_run_funnel_report_rest(request_type):
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = analytics_data_api.RunFunnelReportResponse.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = analytics_data_api.RunFunnelReportResponse.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -2259,6 +2260,75 @@ def test_create_audience_list_rest(request_type):
"state": 1,
"begin_creating_time": {"seconds": 751, "nanos": 543},
}
# The version of a generated dependency at test runtime may differ from the version used during generation.
# Delete any fields which are not present in the current runtime dependency
# See https://github.com/googleapis/gapic-generator-python/issues/1748

# Determine if the message type is proto-plus or protobuf
test_field = analytics_data_api.CreateAudienceListRequest.meta.fields[
"audience_list"
]

def get_message_fields(field):
# Given a field which is a message (composite type), return a list with
# all the fields of the message.
# If the field is not a composite type, return an empty list.
message_fields = []

if hasattr(field, "message") and field.message:
is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR")

if is_field_type_proto_plus_type:
message_fields = field.message.meta.fields.values()
# Add `# pragma: NO COVER` because there may not be any `*_pb2` field types
else: # pragma: NO COVER
message_fields = field.message.DESCRIPTOR.fields
return message_fields

runtime_nested_fields = [
(field.name, nested_field.name)
for field in get_message_fields(test_field)
for nested_field in get_message_fields(field)
]

subfields_not_in_runtime = []

# For each item in the sample request, create a list of sub fields which are not present at runtime
# Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime
for field, value in request_init["audience_list"].items(): # pragma: NO COVER
result = None
is_repeated = False
# For repeated fields
if isinstance(value, list) and len(value):
is_repeated = True
result = value[0]
# For fields where the type is another message
if isinstance(value, dict):
result = value

if result and hasattr(result, "keys"):
for subfield in result.keys():
if (field, subfield) not in runtime_nested_fields:
subfields_not_in_runtime.append(
{
"field": field,
"subfield": subfield,
"is_repeated": is_repeated,
}
)

# Remove fields from the sample request which are not present in the runtime version of the dependency
# Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime
for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER
field = subfield_to_delete.get("field")
field_repeated = subfield_to_delete.get("is_repeated")
subfield = subfield_to_delete.get("subfield")
if subfield:
if field_repeated:
for i in range(0, len(request_init["audience_list"][field])):
del request_init["audience_list"][field][i][subfield]
else:
del request_init["audience_list"][field][subfield]
request = request_type(**request_init)

# Mock the http request call within the method and fake a response.
Expand Down Expand Up @@ -2441,14 +2511,6 @@ def test_create_audience_list_rest_bad_request(

# send a request that will satisfy transcoding
request_init = {"parent": "properties/sample1"}
request_init["audience_list"] = {
"name": "name_value",
"audience": "audience_value",
"audience_display_name": "audience_display_name_value",
"dimensions": [{"dimension_name": "dimension_name_value"}],
"state": 1,
"begin_creating_time": {"seconds": 751, "nanos": 543},
}
request = request_type(**request_init)

# Mock the http request call within the method and fake a BadRequest error.
Expand Down Expand Up @@ -2552,8 +2614,9 @@ def test_query_audience_list_rest(request_type):
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = analytics_data_api.QueryAudienceListResponse.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = analytics_data_api.QueryAudienceListResponse.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -2670,8 +2733,9 @@ def test_query_audience_list_rest_flattened():
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = analytics_data_api.QueryAudienceListResponse.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = analytics_data_api.QueryAudienceListResponse.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)
response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value

Expand Down Expand Up @@ -2739,8 +2803,9 @@ def test_get_audience_list_rest(request_type):
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = analytics_data_api.AudienceList.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = analytics_data_api.AudienceList.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -2818,8 +2883,9 @@ def test_get_audience_list_rest_required_fields(
response_value = Response()
response_value.status_code = 200

pb_return_value = analytics_data_api.AudienceList.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = analytics_data_api.AudienceList.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -2944,8 +3010,9 @@ def test_get_audience_list_rest_flattened():
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = analytics_data_api.AudienceList.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = analytics_data_api.AudienceList.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)
response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value

Expand Down Expand Up @@ -3009,8 +3076,9 @@ def test_list_audience_lists_rest(request_type):
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = analytics_data_api.ListAudienceListsResponse.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = analytics_data_api.ListAudienceListsResponse.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -3092,10 +3160,9 @@ def test_list_audience_lists_rest_required_fields(
response_value = Response()
response_value.status_code = 200

pb_return_value = analytics_data_api.ListAudienceListsResponse.pb(
return_value
)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = analytics_data_api.ListAudienceListsResponse.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -3230,8 +3297,9 @@ def test_list_audience_lists_rest_flattened():
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = analytics_data_api.ListAudienceListsResponse.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = analytics_data_api.ListAudienceListsResponse.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)
response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1941,8 +1941,9 @@ def test_run_report_rest(request_type):
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = analytics_data_api.RunReportResponse.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = analytics_data_api.RunReportResponse.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -2068,8 +2069,9 @@ def test_run_pivot_report_rest(request_type):
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = analytics_data_api.RunPivotReportResponse.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = analytics_data_api.RunPivotReportResponse.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -2194,8 +2196,9 @@ def test_batch_run_reports_rest(request_type):
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = analytics_data_api.BatchRunReportsResponse.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = analytics_data_api.BatchRunReportsResponse.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -2320,10 +2323,9 @@ def test_batch_run_pivot_reports_rest(request_type):
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = analytics_data_api.BatchRunPivotReportsResponse.pb(
return_value
)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = analytics_data_api.BatchRunPivotReportsResponse.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -2450,8 +2452,9 @@ def test_get_metadata_rest(request_type):
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = analytics_data_api.Metadata.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = analytics_data_api.Metadata.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -2526,8 +2529,9 @@ def test_get_metadata_rest_required_fields(
response_value = Response()
response_value.status_code = 200

pb_return_value = analytics_data_api.Metadata.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = analytics_data_api.Metadata.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -2652,8 +2656,9 @@ def test_get_metadata_rest_flattened():
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = analytics_data_api.Metadata.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = analytics_data_api.Metadata.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)
response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value

Expand Down Expand Up @@ -2717,8 +2722,9 @@ def test_run_realtime_report_rest(request_type):
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = analytics_data_api.RunRealtimeReportResponse.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = analytics_data_api.RunRealtimeReportResponse.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down Expand Up @@ -2844,8 +2850,9 @@ def test_check_compatibility_rest(request_type):
# Wrap the value into a proper Response obj
response_value = Response()
response_value.status_code = 200
pb_return_value = analytics_data_api.CheckCompatibilityResponse.pb(return_value)
json_return_value = json_format.MessageToJson(pb_return_value)
# Convert return value to protobuf type
return_value = analytics_data_api.CheckCompatibilityResponse.pb(return_value)
json_return_value = json_format.MessageToJson(return_value)

response_value._content = json_return_value.encode("UTF-8")
req.return_value = response_value
Expand Down

0 comments on commit 030f315

Please sign in to comment.