mirror of
https://github.com/ae-utbm/sith.git
synced 2025-08-24 09:51:07 +00:00
Add test for sentry-debug endpoint
This commit is contained in:
13
sith/urls.py
13
sith/urls.py
@@ -17,6 +17,7 @@ from ajax_select import urls as ajax_select_urls
|
||||
from django.conf import settings
|
||||
from django.conf.urls.static import static
|
||||
from django.contrib import admin
|
||||
from django.http import Http404
|
||||
from django.urls import include, path
|
||||
from django.views.i18n import JavaScriptCatalog
|
||||
from ninja_extra import NinjaExtraAPI
|
||||
@@ -71,11 +72,12 @@ if settings.DEBUG:
|
||||
|
||||
urlpatterns += [path("__debug__/", include(debug_toolbar.urls))]
|
||||
|
||||
if settings.SENTRY_ENV == "development" and settings.SENTRY_DSN:
|
||||
|
||||
def sentry_debug(request):
|
||||
"""Sentry debug endpoint
|
||||
|
||||
This function always crash and allows us to test
|
||||
the sentry configuration and the modal popup
|
||||
the sentry configuration and the modal popup
|
||||
displayed to users on production
|
||||
|
||||
The error will be displayed on Sentry
|
||||
@@ -83,8 +85,9 @@ if settings.SENTRY_ENV == "development" and settings.SENTRY_DSN:
|
||||
|
||||
NOTE : you need to specify the SENTRY_DSN setting in settings_custom.py
|
||||
"""
|
||||
if settings.SENTRY_ENV != "development" or not settings.SENTRY_DSN:
|
||||
raise Http404
|
||||
_division_by_zero = 1 / 0
|
||||
|
||||
def raise_exception(request):
|
||||
_division_by_zero = 1 / 0
|
||||
|
||||
urlpatterns += [path("sentry-debug/", raise_exception)]
|
||||
urlpatterns += [path("sentry-debug/", sentry_debug, name="sentry-debug")]
|
||||
|
Reference in New Issue
Block a user