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

Commit 25bb181

Browse files
committed
made header check not dependant on positioning
1 parent 4d170a5 commit 25bb181

2 files changed

Lines changed: 10 additions & 68 deletions

File tree

owlbot.py

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -127,32 +127,19 @@ def get_staging_dirs(
127127
# fix tests
128128
s.replace(
129129
"tests/unit/gapic/bigtable_v2/test_bigtable.py",
130-
'expected_headers = {"name": "projects/sample1/instances/sample2"}',
131-
'expected_headers = {"name": "projects/sample1/instances/sample2", "app_profile_id": ""}'
130+
'gapic_v1\.routing_header\.to_grpc_metadata\(expected_headers\) in kw["metadata"]',
131+
"""
132+
# assert the expected headers are present, in any order
133+
routing_string = next(iter([m[1] for m in kw["metadata"] if m[0] == 'x-goog-request-params']))
134+
assert all(
135+
[f"{k}={v}" for k,v in expected_headers.items() in routing_string]
136+
)
137+
"""
132138
)
133139
s.replace(
134140
"tests/unit/gapic/bigtable_v2/test_bigtable.py",
135-
"""
136-
"authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/sample4"
137-
}
138-
\)
139-
140-
assert args\[0\] == request_msg
141-
142-
expected_headers = {
143-
"table_name": "projects/sample1/instances/sample2/tables/sample3",
144-
""",
145-
"""
146-
"authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/sample4"
147-
}
148-
)
149-
150-
assert args[0] == request_msg
151-
152-
expected_headers = {
153-
"app_profile_id": "",
154-
"table_name": "projects/sample1/instances/sample2/tables/sample3"
155-
"""
141+
'expected_headers = {"name": "projects/sample1/instances/sample2"}',
142+
'expected_headers = {"name": "projects/sample1/instances/sample2", "app_profile_id": ""}'
156143
)
157144
s.replace(
158145
"tests/unit/gapic/bigtable_v2/test_bigtable.py",

0 commit comments

Comments
 (0)