Consolidate basic API unit test setup and prepare for expansion options.

Review Request #13376 — Created Oct. 25, 2023 and submitted — Latest diff uploaded

Information

Review Board
release-5.0.x

Reviewers

Our API unit test setup has grown over time in ways that made it hard to
build upon.

We had dedicated methods for the Local Site setup that took care of
fixture loading, authentication, subclass setup state, and some
assertions, but we didn't have this for non-Local Site tests, each of
which had to implement this setup manually, leading to inconsistencies.

The setup functions we did have used tuple results, which made them hard
to build upon. This is also an issue for the subclass's return values
(though changing that is out of scope for this work and isn't necessary
for upcoming changes).

This change moves the setup functions out of the Local Site mixins and
into the base test class mixins, giving them options for controlling
some more aspects of test setup to meet all the current needs. They also
now return dictionaries of information.

These changes make it easier to expand upon this for some upcoming 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
Consolidate basic API unit test setup and prepare for expansion options.
Our API unit test setup has grown over time in ways that made it hard to build upon. We had dedicated methods for the Local Site setup that took care of fixture loading, authentication, subclass setup state, and some assertions, but we didn't have this for non-Local Site tests, each of which had to implement this setup manually, leading to inconsistencies. The setup functions we did have used tuple results, which made them hard to build upon. This is also an issue for the subclass's return values (though changing that is out of scope for this work and isn't necessary for upcoming changes). This change moves the setup functions out of the Local Site mixins and into the base test class mixins, giving them options for controlling some more aspects of test setup to meet all the current needs. They also now return dictionaries of information. These changes make it easier to expand upon this for some upcoming work.
7fc7ad41cd8b3c720c0a32aa5d52cc611a2e36a3 Christian Hammond
reviewboard/webapi/tests/mixins.py
reviewboard/webapi/tests/test_oauth_app.py
Loading...