test_libjuju.py as a guidelineEven though the Test Cases still have plenty of potential improvements we feel like this file is the most polished of all of them. Therefore it should be used as a baseline of any future tests or changes in current tests for what is the minimum standard.
There are some cases where FakeClasses (which still inherit from Mock classes) are used. This is only for the cases where the construction of the object requires to much additional mocking. Using standard mocks gives more testing possibilities.
It is preferrable to have a TestCase Class for each method and several test methods to test different scenarios. If all of the classes need the same setup a Parent TestCase class can be created with a setUp method and afterwards the other TestCases can inherit from it like this:
class GetControllerTest(LibjujuTestCase): def setUp(self): super(GetControllerTest, self).setUp()
It is more important to actually assert the important logic than have a high code coverage but not actually testing the code.
These are some of the things that should be always asserted: