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

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

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.

Summary ID
Add expected query utilities for common tests, 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.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.
61b9fea1e81def2ea936758495ece621d0bb61e4
Description From Last Updated

'django.db.models.Q' imported but unused Column: 1 Error code: F401

reviewbotreviewbot

Missing documentation for note.

maubinmaubin

Missing documentation for note.

maubinmaubin

Typo: "uesd" -> "used"

maubinmaubin

Copy paste oopsie "Group.objects.accessible()".

maubinmaubin
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

chipx86
david
  1. Ship It!
  2. 
      
chipx86
david
  1. Ship It!
  2. 
      
maubin
  1. 
      
  2. reviewboard/accounts/testing/queries.py (Diff revision 3)
     
     
    Show all issues

    Missing documentation for note.

  3. reviewboard/site/testing/queries.py (Diff revision 3)
     
     
    Show all issues

    Missing documentation for note.

  4. reviewboard/testing/queries/base.py (Diff revision 3)
     
     
    Show all issues

    Typo: "uesd" -> "used"

  5. reviewboard/testing/queries/http.py (Diff revision 3)
     
     
    Show all issues

    Copy paste oopsie "Group.objects.accessible()".

  6. 
      
chipx86
maubin
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-5.0.x (e7084f3)