From 162d4347e7222536d750d55775f4a923b6dc9f74 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 2 Dec 2021 10:53:46 +0100 Subject: [PATCH] more implementation tests --- InvenTree/common/tests.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/InvenTree/common/tests.py b/InvenTree/common/tests.py index 5b0249272e..9138af7cf0 100644 --- a/InvenTree/common/tests.py +++ b/InvenTree/common/tests.py @@ -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