2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 13:05:42 +00:00

patch loading methods for selective loading

This commit is contained in:
Matthias
2022-04-05 01:29:19 +02:00
parent 42f630cff1
commit 785cdc5267
3 changed files with 15 additions and 6 deletions

View File

@ -131,8 +131,13 @@ class MethodStorageClass:
liste = None
user_settings = {}
def collect(self):
storage.liste = inheritors(NotificationMethod) - IGNORED_NOTIFICATION_CLS
def collect(self, selected_classes=None):
current_method = inheritors(NotificationMethod) - IGNORED_NOTIFICATION_CLS
# for testing selective loading is made available
if selected_classes:
current_method = [item for item in current_method if item is selected_classes]
storage.liste = current_method
def get_usersettings(self, user):
methods = []

View File

@ -95,7 +95,7 @@ class BulkNotificationMethodTests(BaseNotificationIntegrationTest):
return [1, ]
with self.assertRaises(NotImplementedError):
self._notification_run()
self._notification_run(WrongImplementation)
class SingleNotificationMethodTests(BaseNotificationIntegrationTest):
@ -113,6 +113,6 @@ class SingleNotificationMethodTests(BaseNotificationIntegrationTest):
return [1, ]
with self.assertRaises(NotImplementedError):
self._notification_run()
self._notification_run(WrongImplementation)
# A integration test for notifications is provided in test_part.PartNotificationTest