Skip to content

Commit 7871fa9

Browse files
authored
fix(gapic-generator): init mock response in version header test (#18488)
The mock for the generated `api_version_header` tests was not initializing a valid response and in some tests, specifically those generated for the extended operations APIs in compute, would fail attempting to access the `response.name`. Link to full breakdown in the bug. Note: We need to add `compute` to the `gapic-generator/tests/integration/goldens/` once we publish it with the api_version information. Fixes http://b/559815865#comment15
1 parent 0b488a3 commit 7871fa9

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

‎packages/gapic-generator/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,7 @@ def test_{{ method_name }}_api_version_header(transport_name):
664664
type(client.transport.{{ method.transport_safe_name|snake_case }}),
665665
'__call__'
666666
) as call:
667+
call.return_value = {{ method.output.ident }}()
667668
client.{{ method_name }}()
668669

669670
# Establish that the api version header was sent.

‎packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ def test_{{ method_name }}_api_version_header(transport_name):
214214
type(client.transport.{{ method.transport_safe_name|snake_case }}),
215215
'__call__'
216216
) as call:
217+
call.return_value = {{ method.output.ident }}()
217218
{% if mode == "async" %}
218219
await client.{{ method_name }}()
219220
{% else %}

0 commit comments

Comments
 (0)