Ignore:
Timestamp:
14 Sep 2011, 00:48:11 (13 years ago)
Author:
uli
Message:

Logger-related stuff.

File:
1 edited

Legend:

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

    r6748 r6754  
    88from zope.interface.verify import verifyClass, verifyObject
    99from waeup.sirp.app import University
    10 from waeup.sirp.testing import (
    11     FunctionalLayer, FunctionalTestCase, get_all_loggers,
    12     remove_new_loggers, remove_logger)
     10from waeup.sirp.testing import FunctionalLayer, FunctionalTestCase
    1311
    1412from waeup.sirp.utils.logger import (
     
    259257    def setUp(self):
    260258        super(LoggerCollectorTests, self).setUp()
    261         self.old_loggers = get_all_loggers()
    262259        # Setup a sample site for each test
    263260        app = University()
     
    281278    def tearDown(self):
    282279        super(LoggerCollectorTests, self).tearDown()
    283         remove_new_loggers(self.old_loggers)
    284280        shutil.rmtree(self.workdir)
    285281        shutil.rmtree(self.dc_root)
     
    357353    def setUp(self):
    358354        super(LogfileChangeTests, self).setUp()
    359         remove_logger('waeup.sirp.app') # In case it lingers around
    360         self.old_loggers = get_all_loggers()
    361355        # Setup a sample site for each test
    362356        app = University()
     
    373367        self.component = self.app['mycomponent']
    374368        setSite(self.app)
    375 
    376369        self.component = LoggingComponent()
    377370        return
     
    379372    def tearDown(self):
    380373        super(LogfileChangeTests, self).tearDown()
    381         remove_new_loggers(self.old_loggers)
    382374        shutil.rmtree(self.workdir)
    383375        shutil.rmtree(self.dc_root)
     
    397389        self.assertTrue(filename2.startswith(self.dc_root_new))
    398390        return
     391
     392    def test_storage_deletion(self):
     393        # When a site is deleted, the loggers should go away as well
     394        self.dc_root_new = tempfile.mkdtemp()
     395        logger1 = self.component.logger.handlers # create entry in collector
     396        collector = queryUtility(ILoggerCollector)
     397        loggers1 = collector.keys()
     398        root = self.app.__parent__
     399        del root['app']
     400        loggers2 = collector.keys()
     401        self.assertEqual(loggers1, ['app'])
     402        self.assertEqual(loggers2, [])
     403        return
Note: See TracChangeset for help on using the changeset viewer.