test: improve routing parameter assert#2131
Merged
Conversation
a5f2c67 to
42f4a17
Compare
42f4a17 to
0586c9a
Compare
0586c9a to
d9664af
Compare
vchudnov-g
reviewed
Sep 9, 2024
Contributor
vchudnov-g
left a comment
There was a problem hiding this comment.
Looks good, but I have some questions to make sure I understand the (pre-existing) structure of the code touched here.
Co-authored-by: Victor Chudnovsky <vchudnov@google.com>
This was referenced Sep 15, 2024
vchudnov-g
approved these changes
Sep 16, 2024
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 |
Contributor
There was a problem hiding this comment.
nit: Consider using a TinyURL or similar, and enclosing the URL in <> so that it's rendered clickable by some tools.
Contributor
Author
There was a problem hiding this comment.
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`. |
Contributor
There was a problem hiding this comment.
nit: I would add a TODO referencing #2160 about refactoring the common code and then removing this sentence.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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