mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
parent
9f5526f489
commit
c81043ba42
@ -1,5 +1,7 @@
|
|||||||
"""Tests for core_notifications."""
|
"""Tests for core_notifications."""
|
||||||
|
|
||||||
|
from django.core import mail
|
||||||
|
|
||||||
from part.test_part import BaseNotificationIntegrationTest
|
from part.test_part import BaseNotificationIntegrationTest
|
||||||
from plugin import registry
|
from plugin import registry
|
||||||
from plugin.builtin.integration.core_notifications import \
|
from plugin.builtin.integration.core_notifications import \
|
||||||
@ -12,6 +14,9 @@ class CoreNotificationTestTests(BaseNotificationIntegrationTest):
|
|||||||
|
|
||||||
def test_email(self):
|
def test_email(self):
|
||||||
"""Ensure that the email notifications run."""
|
"""Ensure that the email notifications run."""
|
||||||
|
# No email should be send
|
||||||
|
self.assertEqual(len(mail.outbox), 0)
|
||||||
|
|
||||||
# enable plugin and set mail setting to true
|
# enable plugin and set mail setting to true
|
||||||
plugin = registry.plugins.get('corenotificationsplugin')
|
plugin = registry.plugins.get('corenotificationsplugin')
|
||||||
plugin.set_setting('ENABLE_NOTIFICATION_EMAILS', True)
|
plugin.set_setting('ENABLE_NOTIFICATION_EMAILS', True)
|
||||||
@ -25,3 +30,6 @@ class CoreNotificationTestTests(BaseNotificationIntegrationTest):
|
|||||||
|
|
||||||
# run through
|
# run through
|
||||||
self._notification_run(CoreNotificationsPlugin.EmailNotification)
|
self._notification_run(CoreNotificationsPlugin.EmailNotification)
|
||||||
|
|
||||||
|
# Now one mail should be send
|
||||||
|
self.assertEqual(len(mail.outbox), 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user