Esempio n. 1
0
 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)
Esempio n. 2
0
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()
Esempio n. 3
0
 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)
Esempio n. 4
0
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)