Add expected query utilities for common tests, accounts and Local Sites.

Review Request #13411 — Created Nov. 9, 2023 and submitted — Latest diff uploaded

Information

Review Board
release-5.0.x

Reviewers

This introduces some new utility functions for generating common
expected queries:

  • reviewboard.accounts.testing.queries:

    • get_user_by_pk_equeries()
    • get_user_local_site_profile_equeries()
    • get_user_profile_equeries()
  • reviewboard.site.testing.queries:

    • get_local_site_by_name_equeries()
    • get_local_site_is_accessible_by_equeries()
    • get_local_site_is_mutable_by_equeries()
    • get_check_local_site_access_equeries()
  • reviewboard.testing.queries.http:

    • get_http_request_user_equeries()
    • get_http_request_start_equeries()

Most of these perform simple checks used at the start of most view
handling. They'll be used for some in-progress test updates, and will
likely be expanded as the equery library grows.

It also introduces a common type for functions that return
Q-expressions: reviewboard.testing.queries.base.ExpectedQResult. This
helps ensure consistent results and typing for these sorts of functions.

In-progress unit tests pass.

Diff Revision 1

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

orig
1
2
3
4

Commits

First Last Summary ID Author
Add expected query utilities for accounts and Local Sites.
This introduces some new utility functions for generating common expected queries: * `reviewboard.accounts.testing.queries`: * `get_user_by_pk_equeries()` * `get_user_local_site_profile_equeries()` * `get_user_profile_equeries()` * `reviewboard.site.testing.queries`: * `get_local_site_by_name_equeries()` * `get_local_site_is_accessible_by_equeries()` * `get_local_site_is_mutable_by_equeries()` * `get_check_local_site_access_equeries()` * `reviewboard.testing.queries`: * `get_http_request_user_equeries()` * `get_http_request_start_equeries()` Most of these perform simple checks used at the start of most view handling. They'll be used for some in-progress test updates, and will likely be expanded as the equery library grows.
0b5dbc21b39cc3c5a9b60041bb828129aeb0fa7a Christian Hammond
docs/manual/extending/coderef/index.rst
reviewboard/accounts/testing/__init__.py
reviewboard/accounts/testing/queries.py
reviewboard/site/testing/__init__.py
reviewboard/site/testing/queries.py
reviewboard/testing/queries.py
Loading...