more implementation tests

This commit is contained in:
Matthias 2021-12-02 10:53:46 +01:00
parent ae13672273
commit 162d4347e7
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076

View File

@ -8,7 +8,10 @@ from django.contrib.auth import get_user_model
from .models import InvenTreeSetting
from .models import NotificationEntry
from .notifications import NotificationMethod
from .notifications import NotificationMethod, SingleNotificationMethod, BulkNotificationMethod
from part.test_part import BaseNotificationIntegrationTest
class SettingsTest(TestCase):
"""
@ -110,7 +113,7 @@ class NotificationEntryTest(TestCase):
self.assertTrue(NotificationEntry.check_recent('test.notification', 1, delta))
class NotificationTests(TestCase):
class NotificationTests(BaseNotificationIntegrationTest):
def test_NotificationMethod(self):
"""ensure the implementation requirements are tested"""
@ -128,4 +131,23 @@ class NotificationTests(TestCase):
with self.assertRaises(NotImplementedError):
AnotherFalseNotificationMethod('', '', '')
def test_SingleNotificationMethod(self):
"""ensure the implementation requirements are tested"""
class WrongImplementation(SingleNotificationMethod):
pass
with self.assertRaises(NotImplementedError):
self._notification_run()
def test_BulkNotificationMethod(self):
"""ensure the implementation requirements are tested"""
class WrongImplementation(BulkNotificationMethod):
pass
with self.assertRaises(NotImplementedError):
self._notification_run()
# A integration test for notifications is provided in test_part.PartNotificationTest