-
Notifications
You must be signed in to change notification settings - Fork 74
test: improve routing parameter assert #2131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
a5f2c67 to
42f4a17
Compare
42f4a17 to
0586c9a
Compare
0586c9a to
d9664af
Compare
vchudnov-g
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but I have some questions to make sure I understand the (pre-existing) structure of the code touched here.
gapic/schema/wrappers.py
Outdated
| def resolve(cls, routing_rule: routing_pb2.RoutingRule, request: Union[dict, str]) -> dict: | ||
| """Resolves the routing header which should be sent along with the request. | ||
| This function performs dynamic header resolution, identical to what's in `_client_macros.j2`. | ||
| https://github.com/googleapis/gapic-generator-python/blob/4c5de8791795f8101f6ec66f80b8a8e5e9a21822/gapic/templates/%25namespace/%25name_%25version/%25sub/services/%25service/_client_macros.j2#L150-L164 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Consider using a TinyURL or similar, and enclosing the URL in <> so that it's rendered clickable by some tools.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Superseded by review comment #2131 (comment)
gapic/schema/wrappers.py
Outdated
| @classmethod | ||
| def resolve(cls, routing_rule: routing_pb2.RoutingRule, request: Union[dict, str]) -> dict: | ||
| """Resolves the routing header which should be sent along with the request. | ||
| This function performs dynamic header resolution, identical to what's in `_client_macros.j2`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I would add a TODO referencing #2160 about refactoring the common code and then removing this sentence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 4bbfd9f
This PR fixes the assert in
test_*_routing_parametersto verify the routing headers inkw['metadata'].The
resolvefunction intests/unit/schema/wrappers/test_routing.pywas moved togapic/schema/wrappers.pyso that it can be used ingapic/templates/tests/unit/gapic/%name_%version/%sub/test_macros.j2Towards #2091