OZtree icon indicating copy to clipboard operation
OZtree copied to clipboard

Add unit tests for all the controllers

Open hyanwong opened this issue 3 years ago • 1 comments

In https://github.com/OneZoom/OZtree/commit/43efa1ef524b83436d45ce74a09f8f00c1e53c6d I added a basic set of tests for the standard functions in the default controller - just checking that they don't bug out with a blank call. If this looks OK to @lentinj, I think we should also add tests for the other controllers (we already have test_controllers_API.py, so this would be test_controllers_tree.py, test_controllers_treeviewer.py, etc).

hyanwong avatar Jan 31 '22 13:01 hyanwong

Seems eminently sensible. Would be nice to avoid the special-case lists though, could you do something like...

  • If a 400 is raised, try again with an OTT and see if that works.
  • If self has a method name of test_{name} or starting with test_{name}_, skip testing that one (since it has it's own tests).

The latter is also useful for things that won't work with the generic tests, so instead of adding to the list you could do e.g:

def test_sponsor_pay(self):
    raise unittest.SkipTest("TODO: Tests not implemented")

...and leave an obvious hole for the real tests to go in.

lentinj avatar Jan 31 '22 14:01 lentinj

This is a duplicate of #410

jrosindell avatar Oct 30 '22 18:10 jrosindell