Beispiel #1
0
 def test_write_log_to_file(self):
     os.remove(settings.LOG['file'])
     setup = logging.setup()
     body = 'TDD is awesome'
     event_type = 'test'
     with setup.applicationbound():
         log = logging.logger()
         log.info(event_type, body=body)
         self.assertTrue(os.path.exists(settings.LOG['file']))
         with open(settings.LOG['file'], 'r') as fd:
             text = fd.read()
             for required_info in \
                     [body, event_type, 'INFO', 'dna.logging']:
                 self.assertTrue(required_info in text)
Beispiel #2
0
 def test_write_log_to_file(self):
     os.remove(settings.LOG['file'])
     setup = logging.setup()
     body = 'TDD is awesome'
     event_type = 'test'
     with setup.applicationbound():
         log = logging.logger()
         log.info(event_type, body=body)
         self.assertTrue(os.path.exists(settings.LOG['file']))
         with open(settings.LOG['file'], 'r') as fd:
             text = fd.read()
             for required_info in \
                     [body, event_type, 'INFO', 'dna.logging']:
                 self.assertTrue(required_info in text)
Beispiel #3
0
 def test_get_dna_logger(self):
     log = logging.logger('batman')
     self.assertTrue(hasattr(log, 'msg'))
     self.assertTrue(isinstance(log._logger, logbook.base.Logger))
     self.assertTrue(log._logger.name == 'batman')
Beispiel #4
0
 def test_get_dna_logger(self):
     log = logging.logger('batman')
     self.assertTrue(hasattr(log, 'msg'))
     self.assertTrue(isinstance(log._logger, logbook.base.Logger))
     self.assertTrue(log._logger.name == 'batman')
Beispiel #5
0
 def test_debug_metrics(self):
     self.assertIsNone(utils.debug_metrics(
         logger(__name__), '2012/01/01', FakePerfs(0.3)))
Beispiel #6
0
 def test_debug_portfolio(self):
     self.assertIsNone(utils.debug_portfolio(
         logger(__name__), '2012/01/01', None))