Skip to content

Test playground transactional behaviour

See !908 (comment 500916)

To test that Playground correctly resets state between test methods when used as setUpTestData, one needs two test methods called in a predefined order, with the first altering the database and file store state, and the second testing that it is the pristine version at the start of the test.

Currently this relies on unittest's guarantee to run test methods in alphabetical order, but other test runners may make different assumptions.

We may want to consider options for making it more solid. Running tearDown/setUp in the test method would not work, since Django does not use them for this kind of housekeeping.

Options I can think of:

  1. Make the two test methods identical, in that they first check that the fixture is pristine and then they alter it: in that case they would test the situation when run in any order
  2. Make a unittest.TestCase that runs the test case in question manually, though I'm not sure how that could be done

Opening an issue to track this

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information