Ignore:
Timestamp:
12 Feb 2011, 14:42:42 (14 years ago)
Author:
uli
Message:

Add unittest for factory base. In the unittest we check for things not
very important to developers. The important bits are explained and
tested in the docstring of the class. The unittest helps us also to
please the test coverage detector.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/utils/tests/test_helpers.py

    r5733 r5735  
    2424from waeup.sirp.utils import helpers
    2525
     26from zope.interface import Interface, implements
     27class IFakeObject(Interface):
     28    """Some marker interface."""
     29
     30class FakeObject(object):
     31    implements(IFakeObject)
     32
     33class FactoryBaseTestCase(unittest.TestCase):
     34
     35    def test_ifaces(self):
     36        # We test all relevant parts in the docstring. But the interfaces
     37        # method has to be tested to please the coverage report as well.
     38        factory = helpers.FactoryBase()
     39        factory.factory = FakeObject
     40        self.assertTrue(factory.getInterfaces()(IFakeObject))
     41        return
     42       
    2643def test_suite():
    2744    suite = unittest.TestSuite()
     45    # Register local test cases...
     46    for testcase in [FactoryBaseTestCase, ]:
     47        suite.addTests(
     48            unittest.TestLoader().loadTestsFromTestCase(testcase)
     49            )
     50    # Add tests from docstrings in helpers.py...
    2851    suite.addTests(
    2952        doctest.DocTestSuite(
Note: See TracChangeset for help on using the changeset viewer.