Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 5
0
 def test_debug_metrics(self):
     self.assertIsNone(utils.debug_metrics(
         logger(__name__), '2012/01/01', FakePerfs(0.3)))
Ejemplo n.º 6
0
 def test_debug_portfolio(self):
     self.assertIsNone(utils.debug_portfolio(
         logger(__name__), '2012/01/01', None))