Ignore:
Timestamp:
21 Jun 2011, 00:43:36 (13 years ago)
Author:
uli
Message:

Add test to check applicants root logger.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_root.py

    r6120 r6442  
    4848    pass
    4949
    50 class ApplicantsRootTestCase(unittest.TestCase):
     50class ApplicantsRootTestCase(FunctionalTestCase):
     51
     52    layer = FunctionalLayer
     53
     54    def setUp(self):
     55        super(ApplicantsRootTestCase, self).setUp()
     56
     57        # Setup a sample site for each test
     58        app = University()
     59        self.dc_root = tempfile.mkdtemp()
     60        app['datacenter'].setStoragePath(self.dc_root)
     61
     62        # Prepopulate the ZODB...
     63        self.getRootFolder()['app'] = app
     64        self.app = self.getRootFolder()['app']
     65        setSite(self.app)
     66        return
     67
     68    def tearDown(self):
     69        super(ApplicantsRootTestCase, self).tearDown()
     70        shutil.rmtree(self.dc_root)
     71        return
    5172
    5273    def test_interfaces(self):
     
    6182            )
    6283        return
     84
     85    def test_logger(self):
     86        # We can get a logger from root
     87        logger = self.app['applicants'].logger
     88        assert logger is not None
     89        assert logger.name == 'waeup.sirp.app.applicants'
     90        handlers = logger.handlers
     91        assert len(handlers) == 1
     92        filename = logger.handlers[0].baseFilename
     93        assert filename.endswith('applicants.log')
     94        assert filename.startswith(self.dc_root)
    6395
    6496class ApplicantsRootPluginTestCase(unittest.TestCase):
Note: See TracChangeset for help on using the changeset viewer.