def _dispatch_notifications( post: 'ForumPost', type: str, user_ids: List[int] ) -> None: for user_id in user_ids: Notification.new( user_id=user_id, type=type, contents={'thread_id': 1, 'post_id': 1, 'from': post.user_id}, )
def test_new_notification_new_type(client): noti = Notification.new( user_id=1, type='new_type', contents={'contents': 'New Type!'} ) assert noti.id == 7 assert noti.contents['contents'] == 'New Type!' assert noti.type_id == 4 assert noti.type == 'new_type' assert noti.read is False
def test_new_notification(client): noti = Notification.new( user_id=1, type='subscripple', contents={'contents': 'New Subscrippletion!'}, ) assert noti.id == 7 assert noti.contents['contents'] == 'New Subscrippletion!' assert noti.read is False