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

Ensure an error gets logged when a delivery method fails (#3144)

* Ensure an error gets logged when a delivery method fails

- Refactor existing code to log a custom error to the database
- Limit error notifications to UI

* Adjust unit test

* Clear existing notifications before run

* Add some debug to work out what is going on

* Accommodate extra notification
This commit is contained in:
Oliver
2022-06-07 08:58:00 +10:00
committed by GitHub
parent 5870b21a91
commit c0148c0a38
6 changed files with 30 additions and 60 deletions

View File

@ -616,6 +616,8 @@ class BaseNotificationIntegrationTest(InvenTreeTestCase):
# reload notification methods
storage.collect(run_class)
NotificationEntry.objects.all().delete()
# There should be no notification runs
self.assertEqual(NotificationEntry.objects.all().count(), 0)
@ -630,8 +632,8 @@ class BaseNotificationIntegrationTest(InvenTreeTestCase):
self.part.set_starred(self.user, True)
self.part.save()
# There should be 1 notification
self.assertEqual(NotificationEntry.objects.all().count(), 1)
# There should be 1 (or 2) notifications - in some cases an error is generated, which creates a subsequent notification
self.assertIn(NotificationEntry.objects.all().count(), [1, 2])
class PartNotificationTest(BaseNotificationIntegrationTest):