def test_create_notifications_for_task_and_comment(self): self.generate_fixture_comment() notifications_service.create_notifications_for_task_and_comment( self.task_dict, self.comment) notifications = Notification.get_all() self.assertEqual(len(notifications), 1) self.assertEqual(notifications[0].author_id, self.user.id)
def create_notification(person, comment, read=False, change=False): """ Create a new notification for given person and comment. """ notification = Notification.create(read=read, change=change, person_id=person["id"], author_id=comment["person_id"], comment_id=comment["id"], task_id=comment["object_id"]) return notification.serialize()
def test_create_notification(self): self.generate_fixture_comment() notification = notifications_service.create_notification( self.person.serialize(), self.comment, False, False) notification_again = Notification.get(notification["id"]) self.assertIsNotNone(notification_again)
def delete_notifications_for_comment(comment_id): notifications = Notification.get_all_by(comment_id=comment_id) for notification in notifications: notification.delete() return fields.serialize_list(notifications)