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)
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)
def logview_filter_app_factory(app, global_conf, **kwargs): return Logview(app, global_conf, **kwargs)
def filter(app): return Logview(app, global_conf, **kwargs)
def make_wsgi_app(self, **kw): logview = Logview(hello_world, keep_tracebacks=True, **kw) return logview