示例#1
0
 def test_splice(self):
     logview = Logview(None)
     testcases = [
         b'[logbar]no body tag',
         b'<html><body>[logbar]text</body></html>',
         b'<html><body class="c">[logbar]text</body></html>',
         b'<html><body>[logbar]text</body><body>haha invalid markup',
     ]
     for expected in testcases:
         orig_body = expected.replace(b'[logbar]', b'')
         self.assertEqual(logview.splice(orig_body, b'[logbar]'), expected)
示例#2
0
 def test_splice(self):
     logview = Logview(None)
     testcases = [
         b'[logbar]no body tag',
         b'<html><body>[logbar]text</body></html>',
         b'<html><body class="c">[logbar]text</body></html>',
         b'<html><body>[logbar]text</body><body>haha invalid markup',
     ]
     for expected in testcases:
         orig_body = expected.replace(b'[logbar]', b'')
         self.assertEqual(logview.splice(orig_body, b'[logbar]'), expected)
示例#3
0
 def test_configuration(self):
     logview = Logview(None,
                       config={
                           'logview.foo': 'red',
                           'traceback.bar': 'green'
                       },
                       stack_formatter=traceback.format_stack,
                       tb_formatter='traceback.format_tb')
     self.assertEqual(logview.log_colors, {'foo': 'red'})
     self.assertEqual(logview.traceback_colors, {'bar': 'green'})
     self.assertEqual(logview.reqhandler.stack_formatter,
                      traceback.format_stack)
     self.assertEqual(logview.reqhandler.tb_formatter, traceback.format_tb)
示例#4
0
def logview_filter_app_factory(app, global_conf, **kwargs):
    return Logview(app, global_conf, **kwargs)
示例#5
0
 def filter(app):
     return Logview(app, global_conf, **kwargs)
示例#6
0
 def make_wsgi_app(self, **kw):
     logview = Logview(hello_world, keep_tracebacks=True, **kw)
     return logview