test_usernotifications.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:django-herald 作者: worthwhile 项目源码 文件源码
def setUp(self):
        User = get_user_model()

        # create a user who does not want to get MyOtherNotification
        user = User(username='test', password='Safepass1.')
        user.save()
        usernotification = UserNotification(user=user)
        usernotification.save()

        # refresh the user
        self.user = User.objects.get(id=user.id)
        # add a notification
        notification = Notification(notification_class=MyOtherNotification.get_class_path())
        notification.save()

        # disable the notification
        self.user.usernotification.disabled_notifications.add(notification)
        self.user = User.objects.get(id=user.id)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号