Exemplo n.º 1
0
 def test_log_log_warning(self):
     """Test that log_warning convenience function logs if enabled."""
     
     with LogCapture() as l:
         event = log_warning("label", "message", self.user, extra=self.extra)
         m = ('eventlog', 'WARNING', "0000000000000001 label (user: johndoe) - message {'key2': 'value2', 'key': 'value'}")
         l.check(m)
         event = log_warning("label", "message", self.user, extra=self.extra, django_log=False)
         l.check(m)
Exemplo n.º 2
0
 def test_convenience_log_warn(self):
     """Test the log_warn convenience function."""
     
     event = log_warning("label", "message", self.user, extra=self.extra)
     self.assertTrue(event.id)
     self.assertEqual(event.label, "label")
     self.assertEqual(event.message, "message")
     self.assertEqual(event.user, self.user)
     self.assertEqual(event.extra, self.extra)
     self.assertEqual(event.level, logging.WARN)