Clean up BaseWebAPITestCase, remove legacy code, and improve performance.

Review Request #13255 — Created Sept. 4, 2023 and submitted

Information

Review Board
release-6.x

Reviewers

BaseWebAPITestCase was a very old class with a lot of legacy functions
that were no longer used. With some changes coming up, it was a good
time to remove these and clean up the code.

All the utility functions for creating and deleting certain types of
objects have been removed. Only one was in use, and only in one place,
so the functionality has intstead been moved into the unit test that
needs it.

We now have typing throughout the class, cleanup of state post-test,
proper documentation, and performance improvements for user login.

The performance improvements remove an unnecessary redundant User
query when logging in an administrator on Local Sites. We were querying
for the same user twice. Along with that, we now use a different login
method that lets us pass in an explicit User, avoiding auth backend
lookups and even more User queries. These save between 10-15 seconds
from the API unit tests locally (there's some variance due to repository
access).

All unit tests pass.

Summary ID
Clean up BaseWebAPITestCase, remove legacy code, and improve performance.
`BaseWebAPITestCase` was a very old class with a lot of legacy functions that were no longer used. With some changes coming up, it was a good time to remove these and clean up the code. All the utility functions for creating and deleting certain types of objects have been removed. Only one was in use, and only in one place, so the functionality has intstead been moved into the unit test that needs it. We now have typing throughout the class, cleanup of state post-test, proper documentation, and performance improvements for user login. The performance improvements remove an unnecessary redundant `User` query when logging in an administrator on Local Sites. We were querying for the same user twice. Along with that, we now use a different login method that lets us pass in an explicit `User`, avoiding auth backend lookups and even more `User` queries. These save between 10-15 seconds from the API unit tests locally (there's some variance due to repository access).
fda7e835b4ca0f8dbad70c8a302dd3ac22b60981
maubin
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-6.x (cf9cbc5)