def test_debug_mode(self): app = ErrorReporter(simple_app, dict(debug='on'), enable=True, error_email='*****@*****.**') assert app is simple_app
def test_enable_email(self): app = ErrorReporter(simple_app, {}, error_email='*****@*****.**') assert app.__class__.__name__ == self.middleware_name assert any(r.__class__.__name__ == 'EmailReporter' for r in app.reporters)
def test_enable_sentry(self): app = ErrorReporter(simple_app, {}, sentry_dsn='http://*****:*****@example.com/1') assert app.__class__.__name__ == self.middleware_name assert any(r.__class__.__name__ == 'SentryReporter' for r in app.reporters)
def test_enable_true(self): app = ErrorReporter(simple_app, {}, enable=True) assert app.__class__.__name__ == self.middleware_name assert not app.reporters
def test_enable_false(self): app = ErrorReporter(simple_app, {}, enable=False) assert app.__class__.__name__ != self.middleware_name
def test_enable_sentry(self): app = ErrorReporter(simple_app, {}, sentry_dsn='http://*****:*****@example.com/1') reporters = [r.__class__.__name__ for r in app.reporters] assert 'SentryReporter' in reporters
def test_enable_email(self): app = ErrorReporter(simple_app, {}, error_email='*****@*****.**') reporters = [r.__class__.__name__ for r in app.reporters] assert 'EmailReporter' in reporters
def test_disable_all(self): app = ErrorReporter(simple_app, {}) reporters = [r.__class__.__name__ for r in app.reporters] assert 'EmailReporter' not in reporters assert 'SentryReporter' not in reporters