• 
      

    Add expected queries and enhance tests for Group access queries.

    Review Request #13406 — Created Nov. 7, 2023 and submitted — Latest diff uploaded

    Information

    Review Board
    release-5.0.x

    Reviewers

    This introduces the reviewboard.reviews.testing.queries.review_groups
    module for query-building functions for tests. It contains the following
    methods:

    • get_review_groups_accessible_q()
    • get_review_groups_accessible_prep_equeries()
    • get_review_groups_accessible_equeries()
    • get_review_groups_accessible_ids_equeries()

    These generate expected Q objects and queries that matches calls to
    Group.objects.accessible() and Group.objects.accessible_ids().
    They're written in a verbose manner that ensures we only ever test
    against finalized Q expressions, to minimize chances of regressions or
    unexpected behavior.

    The unit tests for .accessible() and .accessible_ids() have been
    completely rewritten. They now check against these expected queries, but
    they've also been expanded considerably to more thoroughly check access
    with positive and negative test data, to better catch regressions. The
    approach being used here will be carried over to other accessibility
    tests for the next batch of this peformance work.

    Unit tests pass.

    Commits

    Files