Adds test to catch notification error

This commit is contained in:
Mouse Reeve 2022-07-09 12:28:47 -07:00
parent a7553c0b8c
commit c092d952bd
2 changed files with 12 additions and 1 deletions

View file

@ -76,6 +76,17 @@ class Notification(TestCase):
notification.refresh_from_db()
self.assertEqual(notification.related_users.count(), 2)
def test_notify_grouping_with_dupes(self):
"""If there are multiple options to group with, don't cause an error"""
models.Notification.objects.create(
user=self.local_user, notification_type="FAVORITE"
)
models.Notification.objects.create(
user=self.local_user, notification_type="FAVORITE"
)
models.Notification.notify(self.local_user, None, notification_type="FAVORITE")
self.assertEqual(models.Notification.objects.count(), 2)
def test_notify_remote(self):
"""Don't create notifications for remote users"""
models.Notification.notify(

View file

@ -15,7 +15,7 @@ from .helpers import (
handle_remote_webfinger,
subscribe_remote_webfinger,
WebFingerError,
is_api_request
is_api_request,
)