mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-30 04:26:44 +00:00
add test for system healt checks
This commit is contained in:
parent
6bc53c1308
commit
ce88deeb3b
@ -89,15 +89,15 @@ def check_system_health(**kwargs):
|
|||||||
|
|
||||||
result = True
|
result = True
|
||||||
|
|
||||||
if not is_worker_running(**kwargs):
|
if not is_worker_running(**kwargs): # pragma: no cover
|
||||||
result = False
|
result = False
|
||||||
logger.warning(_("Background worker check failed"))
|
logger.warning(_("Background worker check failed"))
|
||||||
|
|
||||||
if not is_email_configured():
|
if not is_email_configured(): # pragma: no cover
|
||||||
result = False
|
result = False
|
||||||
logger.warning(_("Email backend not configured"))
|
logger.warning(_("Email backend not configured"))
|
||||||
|
|
||||||
if not result:
|
if not result: # pragma: no cover
|
||||||
logger.warning(_("InvenTree system health checks failed"))
|
logger.warning(_("InvenTree system health checks failed"))
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
@ -12,6 +12,7 @@ from djmoney.contrib.exchange.exceptions import MissingRate
|
|||||||
from .validators import validate_overage, validate_part_name
|
from .validators import validate_overage, validate_part_name
|
||||||
from . import helpers
|
from . import helpers
|
||||||
from . import version
|
from . import version
|
||||||
|
from . import status
|
||||||
|
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
@ -389,3 +390,12 @@ class CurrencyTests(TestCase):
|
|||||||
# Convert to a symbol which is not covered
|
# Convert to a symbol which is not covered
|
||||||
with self.assertRaises(MissingRate):
|
with self.assertRaises(MissingRate):
|
||||||
convert_money(Money(100, 'GBP'), 'ZWL')
|
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())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user