Update webapi test suite to test invalid PUT/POST operations.
Review Request #13285 — Created Sept. 22, 2023 and submitted — Latest diff uploaded
The API resource implementation previously prevented POST requests to
item resources, and with a new change to Djblets, will also prevent PUT
requests to list resources. However, neither of these was properly
tested in the test suite.This change updates our API test mixins to test these scenarios where
appropriate. Most of the individual test suites needed to add some setup
methods to handle this appropriately.Unfortunately, the naming of the setup methods isn't ideal.
setup_http_not_allowed_item_test
should really be
setup_http_not_allowed_put_test
, and
setup_http_not_allowed_list_test
should be
setup_http_not_allowed_post_test
. These also do not currently support
similar test cases for when there is a local site (though that shouldn't
be a problem). Rather than trying to rename these methods now, I've just
gone with the old ones, and we can address the naming later. For this
reason I'm also holding off on adding missing docstrings or typing,
merely trying to match it to the individual style of each existing test
case.
Ran unit tests.