add test for system healt checks

This commit is contained in:
Matthias 2022-02-13 19:56:30 +01:00
parent 6bc53c1308
commit ce88deeb3b
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076
2 changed files with 13 additions and 3 deletions

View File

@ -89,15 +89,15 @@ def check_system_health(**kwargs):
result = True
if not is_worker_running(**kwargs):
if not is_worker_running(**kwargs): # pragma: no cover
result = False
logger.warning(_("Background worker check failed"))
if not is_email_configured():
if not is_email_configured(): # pragma: no cover
result = False
logger.warning(_("Email backend not configured"))
if not result:
if not result: # pragma: no cover
logger.warning(_("InvenTree system health checks failed"))
return result

View File

@ -12,6 +12,7 @@ from djmoney.contrib.exchange.exceptions import MissingRate
from .validators import validate_overage, validate_part_name
from . import helpers
from . import version
from . import status
from decimal import Decimal
@ -389,3 +390,12 @@ class CurrencyTests(TestCase):
# Convert to a symbol which is not covered
with self.assertRaises(MissingRate):
convert_money(Money(100, 'GBP'), 'ZWL')
class TestStatus(TestCase):
"""
Unit tests for status functions
"""
def test_check_system_healt(self):
self.assertTrue(status.check_system_health())