Add expected queries and enhance tests for Repository access queries.

Review Request #13409 — Created Nov. 8, 2023 and submitted — Latest diff uploaded

Information

Review Board
release-5.0.x

Reviewers

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.

Diff Revision 2

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

orig
1
2
3

Commits

First Last Summary ID Author
Add expected queries and enhance tests for Repository access queries.
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.
9f6633a53ca2bd96e587880e8b15b26d80ddb5ce Christian Hammond
docs/manual/extending/coderef/index.rst
reviewboard/scmtools/testing/__init__.py
reviewboard/scmtools/testing/queries.py
reviewboard/scmtools/tests/test_repository_manager.py
Loading...