From 4e07b4bf721c457f5d414f1c930c22c40cc99b28 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 4 Dec 2021 01:10:46 +0100 Subject: [PATCH] fix tests + method name test --- InvenTree/common/test_notifications.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/InvenTree/common/test_notifications.py b/InvenTree/common/test_notifications.py index 8eff1ef7fc..0e645585ad 100644 --- a/InvenTree/common/test_notifications.py +++ b/InvenTree/common/test_notifications.py @@ -11,23 +11,33 @@ class NotificationTests(BaseNotificationIntegrationTest): """ensure the implementation requirements are tested""" class FalseNotificationMethod(NotificationMethod): - pass + METHOD_NAME = 'FalseNotification' class AnotherFalseNotificationMethod(NotificationMethod): + METHOD_NAME = 'AnotherFalseNotification' + def send(self): pass + class NoNameNotificationMethod(NotificationMethod): + pass + with self.assertRaises(NotImplementedError): FalseNotificationMethod('', '', '') with self.assertRaises(NotImplementedError): AnotherFalseNotificationMethod('', '', '') + with self.assertRaises(NotImplementedError): + NoNameNotificationMethod('', '', '') + def test_SingleNotificationMethod(self): """ensure the implementation requirements are tested""" print('TESTING SingleNotificationMethod') class WrongImplementation(SingleNotificationMethod): + METHOD_NAME = 'WrongImplementation1' + def setup(self): print('running setup on WrongImplementation') return super().setup() @@ -40,6 +50,8 @@ class NotificationTests(BaseNotificationIntegrationTest): print('TESTING BulkNotificationMethod') class WrongImplementation(BulkNotificationMethod): + METHOD_NAME = 'WrongImplementation2' + def setup(self): print('running setup on WrongImplementation') return super().setup()