def test_get_logger(self): app = App(('--config', self.config_filename, '--log-syslog')) logger = app.get_logger() self.assertEqual(logging.WARN, logger.getEffectiveLevel()) self.assertEqual(3, len(logger.handlers)) null_handler, stderr_handler, syslog_handler = logger.handlers self.assertIsInstance(stderr_handler, logging.StreamHandler) self.assertEqual(stderr_handler.stream, sys.stderr) self.assertIsInstance(syslog_handler, logging.handlers.SysLogHandler)
def test_create_server(self): app = App(['--config', self.config_filename, '--flush-interval', '17']) logger = app.get_logger() server = app.create_server() queue_processor = server.queue_processor self.assertEqual(server.logger, logger) self.assertIsInstance(queue_processor, QueueProcessor) self.assertEqual(queue_processor.logger, logger) self.assertEqual(queue_processor.flush_interval, 17)