Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit 9647046

Browse files
committed
fix: update ads-templates test to verify query params in URL
1 parent 844fb19 commit 9647046

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import grpc
1818
from grpc.experimental import aio
1919
{% if "rest" in opts.transport %}
2020
from collections.abc import Iterable
21+
import urllib.parse
22+
2123
from google.protobuf import json_format
2224
import json
2325
{% endif %}
@@ -1451,8 +1453,12 @@ def test_{{ method_name }}_rest_required_fields(request_type={{ method.input.ide
14511453
('$alt', 'json;enum-encoding=int')
14521454
{% endif %}
14531455
]
1454-
actual_params = req.call_args.kwargs['params']
1455-
assert expected_params == actual_params
1456+
# Verify query params are correctly included in the URL
1457+
# Session.request is called as request(method, url, ...), so url is args[1]
1458+
actual_url = req.call_args.args[1]
1459+
parsed_url = urllib.parse.urlparse(actual_url)
1460+
actual_params = urllib.parse.parse_qsl(parsed_url.query, keep_blank_values=True)
1461+
assert set(expected_params).issubset(set(actual_params))
14561462

14571463

14581464
def test_{{ method_name }}_rest_unset_required_fields():

0 commit comments

Comments
 (0)