mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-28 11:36:44 +00:00
Validate that errors get logged
This commit is contained in:
parent
adaec90909
commit
07319731d2
@ -6,6 +6,8 @@ from django.urls import include, re_path, reverse
|
|||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.contrib.auth.models import Group
|
from django.contrib.auth.models import Group
|
||||||
|
|
||||||
|
from error_report.models import Error
|
||||||
|
|
||||||
from plugin import InvenTreePlugin
|
from plugin import InvenTreePlugin
|
||||||
from plugin.mixins import AppMixin, SettingsMixin, UrlsMixin, NavigationMixin, APICallMixin
|
from plugin.mixins import AppMixin, SettingsMixin, UrlsMixin, NavigationMixin, APICallMixin
|
||||||
from plugin.urls import PLUGIN_BASE
|
from plugin.urls import PLUGIN_BASE
|
||||||
@ -391,6 +393,8 @@ class PanelMixinTests(TestCase):
|
|||||||
# Enable the 'broken panel' setting - this will cause all panels to not render
|
# Enable the 'broken panel' setting - this will cause all panels to not render
|
||||||
plugin.set_setting('ENABLE_BROKEN_PANEL', True)
|
plugin.set_setting('ENABLE_BROKEN_PANEL', True)
|
||||||
|
|
||||||
|
n_errors = Error.objects.count()
|
||||||
|
|
||||||
for url in urls:
|
for url in urls:
|
||||||
response = self.client.get(url)
|
response = self.client.get(url)
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
@ -400,3 +404,6 @@ class PanelMixinTests(TestCase):
|
|||||||
self.assertNotIn('Hello world!', str(response.content))
|
self.assertNotIn('Hello world!', str(response.content))
|
||||||
self.assertNotIn('Broken Panel', str(response.content))
|
self.assertNotIn('Broken Panel', str(response.content))
|
||||||
self.assertNotIn('Custom Part Panel', str(response.content))
|
self.assertNotIn('Custom Part Panel', str(response.content))
|
||||||
|
|
||||||
|
# Assert that each request threw an error
|
||||||
|
self.assertEqual(Error.objects.count(), n_errors + len(urls))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user