Enable expansion of resource links in unit tests.
Review Request #12260 — Created April 26, 2022 and submitted — Latest diff uploaded
URLMapTransport
now supports the?expand=
query string argument,
allowing links to be expanded. When set, the transport will look up any
links listed and try to expand them in the resource before returning it
(and will also attempt to recurse into the expanded resources and expand
links within those).If an expanded URL is not registered, or it's mapped to a HTTP 404
response, then the expansion will be empty (None
or[]
).Normally, a list will be expanded to a list, and a dictionary to a
dictionary. This can be overridden to expand a dictionary into a 1-item
list of dictionaries (needed for review request drafts, due to a design
flaw in the original API). This is done through alink_expansion_types
dictionary that can be set during URL registration.
Made use of this with some in-development unit tests. All tests pass on
all supported versions of Python.Same for all existing tests as of this change.