Enable expansion of resource links in unit tests.

Review Request #12260 — Created April 26, 2022 and submitted — Latest diff uploaded

Information

RBTools
release-3.x

Reviewers

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 a link_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.

Diff Revision 1

This is not the most recent revision of the diff. The latest diff is revision 5. See what's changed.

orig
1
2
3
4
5

Commits

First Last Summary ID Author
Enable expansion of resource links in unit tests.
`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). This requires that any expanded resources have their URLs registered first.
cafcca35ac25ef62c952fb4e7075ddb4177ead56 Christian Hammond
rbtools/testing/api/payloads.py
rbtools/testing/api/transport.py
Loading...