-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #434 from Xpirix/handle_various_sentry_errors
Handle various sentry errors
- Loading branch information
Showing
15 changed files
with
234 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from django.test import TestCase, RequestFactory | ||
from django.template import TemplateDoesNotExist | ||
from middleware import HandleTemplateDoesNotExistMiddleware | ||
from django.urls import path | ||
from django.urls import reverse | ||
|
||
class HandleTemplateDoesNotExistMiddlewareTest(TestCase): | ||
fixtures = ["fixtures/simplemenu.json"] | ||
def setUp(self): | ||
# Mock get_response function | ||
self.factory = RequestFactory() | ||
self.get_response = lambda request: None | ||
self.middleware = HandleTemplateDoesNotExistMiddleware(self.get_response) | ||
|
||
def test_template_does_not_exist(self): | ||
url = '/planet/template' | ||
response = self.client.get(url) | ||
|
||
self.assertEqual(response.status_code, 404) | ||
self.assertTemplateUsed( | ||
response, '404.html' | ||
) | ||
|
||
def test_no_template_error(self): | ||
request = self.factory.get('/planet/template') | ||
|
||
# Simulate a different exception | ||
response = self.middleware.process_exception(request, Exception("Some other error")) | ||
|
||
# Check that the middleware does not handle this | ||
self.assertIsNone(response) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from plugins.tasks.generate_plugins_xml import * # noqa | ||
from plugins.tasks.update_feedjack import * # noqa | ||
from plugins.tasks.update_qgis_versions import * # noqa | ||
from plugins.tasks.rebuild_search_index import * # noqa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from celery import shared_task | ||
from celery.utils.log import get_task_logger | ||
|
||
logger = get_task_logger(__name__) | ||
|
||
|
||
@shared_task | ||
def rebuild_index(): | ||
import subprocess | ||
subprocess.call(['python', 'manage.py', 'rebuild_index']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.