Add expected queries and enhance tests for Repository access queries.
Review Request #13409 — Created Nov. 8, 2023 and submitted — Latest diff uploaded
This adds pre-built expected queries for:
Repository.objects.accessible()
Repository.objects.accessible_ids()
These functions live in reviewboard.scmtools.testing.queries
, and can
be reused throughout our test suite. It's 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.