From 3eed7bb0102d8ceb7727211f5d4b5f7bfe3c4aa1 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 1 Jan 2022 18:56:14 +0100 Subject: [PATCH] lib: dont send any sentry events when testing Signed-off-by: Jens Langhammer --- authentik/lib/sentry.py | 2 +- authentik/lib/tests/test_sentry.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/authentik/lib/sentry.py b/authentik/lib/sentry.py index a0bd4eeec..5744d1623 100644 --- a/authentik/lib/sentry.py +++ b/authentik/lib/sentry.py @@ -114,6 +114,6 @@ def before_send(event: dict, hint: dict) -> Optional[dict]: ]: return None LOGGER.debug("sending event to sentry", exc=exc_value, source_logger=event.get("logger", None)) - if settings.DEBUG: + if settings.DEBUG or settings.TEST: return None return event diff --git a/authentik/lib/tests/test_sentry.py b/authentik/lib/tests/test_sentry.py index 958ef5041..8ad6f7954 100644 --- a/authentik/lib/tests/test_sentry.py +++ b/authentik/lib/tests/test_sentry.py @@ -13,4 +13,4 @@ class TestSentry(TestCase): def test_error_sent(self): """Test error sent""" - self.assertEqual({}, before_send({}, {"exc_info": (0, ValueError(), 0)})) + self.assertEqual(None, before_send({}, {"exc_info": (0, ValueError(), 0)}))