Esempio n. 1
0
 def test_logging_default_setup(self):
     setup = logging.setup()
     handler = setup.objects[1]
     self.assertTrue(isinstance(
         handler, logbook.handlers.FileHandler))
     self.assertTrue(handler.level_name == 'DEBUG')
     self.assertTrue(handler.stream.name == settings.LOG['file'])
Esempio n. 2
0
 def test_logging_custom_file_setup(self):
     custom_level = 'warning'
     custom_logfile = '/tmp/test-dna.log'
     setup = logging.setup(level=custom_level, filename=custom_logfile)
     handler = setup.objects[1]
     self.assertTrue(isinstance(handler, logbook.handlers.FileHandler))
     self.assertTrue(handler.level_name == custom_level.upper())
     self.assertTrue(handler.stream.name == custom_logfile)
Esempio n. 3
0
 def test_logging_custom_file_setup(self):
     custom_level = 'warning'
     custom_logfile = '/tmp/test-dna.log'
     setup = logging.setup(level=custom_level, filename=custom_logfile)
     handler = setup.objects[1]
     self.assertTrue(isinstance(
         handler, logbook.handlers.FileHandler))
     self.assertTrue(handler.level_name == custom_level.upper())
     self.assertTrue(handler.stream.name == custom_logfile)
Esempio n. 4
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)
Esempio n. 5
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)
Esempio n. 6
0
 def test_logging_default_setup(self):
     setup = logging.setup()
     handler = setup.objects[1]
     self.assertTrue(isinstance(handler, logbook.handlers.FileHandler))
     self.assertTrue(handler.level_name == 'DEBUG')
     self.assertTrue(handler.stream.name == settings.LOG['file'])