providers/oauth2: fix tests

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-05-14 12:29:37 +02:00
parent 18f450bd49
commit f391c33bdf
3 changed files with 4 additions and 2 deletions

View File

@ -72,7 +72,7 @@ def sentry_init(**sentry_init_kwargs):
], ],
before_send=before_send, before_send=before_send,
release=f"authentik@{__version__}", release=f"authentik@{__version__}",
**kwargs **kwargs,
) )
set_tag("authentik.build_hash", get_build_hash("tagged")) set_tag("authentik.build_hash", get_build_hash("tagged"))
set_tag("authentik.env", get_env()) set_tag("authentik.env", get_env())
@ -82,6 +82,7 @@ def sentry_init(**sentry_init_kwargs):
env=kwargs["environment"], env=kwargs["environment"],
) )
def before_send(event: dict, hint: dict) -> Optional[dict]: def before_send(event: dict, hint: dict) -> Optional[dict]:
"""Check if error is database error, and ignore if so""" """Check if error is database error, and ignore if so"""
# pylint: disable=no-name-in-module # pylint: disable=no-name-in-module

View File

@ -13,4 +13,4 @@ class TestSentry(TestCase):
def test_error_sent(self): def test_error_sent(self):
"""Test error sent""" """Test error sent"""
self.assertEqual(None, before_send({}, {"exc_info": (0, ValueError(), 0)})) self.assertEqual({}, before_send({}, {"exc_info": (0, ValueError(), 0)}))

View File

@ -292,6 +292,7 @@ class TestAuthorize(OAuthTestCase):
"component": "ak-stage-autosubmit", "component": "ak-stage-autosubmit",
"type": ChallengeTypes.NATIVE.value, "type": ChallengeTypes.NATIVE.value,
"url": "http://localhost", "url": "http://localhost",
"title": "Redirecting to app...",
"attrs": { "attrs": {
"access_token": token.access_token, "access_token": token.access_token,
"id_token": provider.encode(token.id_token.to_dict()), "id_token": provider.encode(token.id_token.to_dict()),