当前位置: 首页>>代码示例>>Python>>正文


Python Comment.notification_list方法代码示例

本文整理汇总了Python中app.models.Comment.notification_list方法的典型用法代码示例。如果您正苦于以下问题:Python Comment.notification_list方法的具体用法?Python Comment.notification_list怎么用?Python Comment.notification_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app.models.Comment的用法示例。


在下文中一共展示了Comment.notification_list方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_notification_list

# 需要导入模块: from app.models import Comment [as 别名]
# 或者: from app.models.Comment import notification_list [as 别名]
 def test_notification_list(self):
     db.create_all()
     u1 = User(email='[email protected]', username='john', password='cat')
     u2 = User(email='[email protected]', username='susan', password='cat')
     t = Talk(title='t', description='d', author=u1)
     c1 = Comment(talk=t, body='c1', author_name='n1',
                  author_email='[email protected]', approved=True)
     c2 = Comment(talk=t, body='c2', author_name='n2',
                  author_email='[email protected]', approved=True, notify=False)
     c3 = Comment(talk=t, body='c3', author=u2, approved=True)
     c4 = Comment(talk=t, body='c4', author_name='n4',
                  author_email='[email protected]', approved=False)
     c5 = Comment(talk=t, body='c5', author=u2, approved=True)
     c6 = Comment(talk=t, body='c6', author_name='n6',
                  author_email='[email protected]', approved=True, notify=False)
     db.session.add_all([u1, u2, t, c1, c2, c3, c4, c5])
     db.session.commit()
     email_list = c4.notification_list()
     self.assertTrue(('[email protected]', 'n1') in email_list)
     self.assertFalse(('[email protected]', 'n2') in email_list)  # notify=False
     self.assertTrue(('[email protected]', 'susan') in email_list)
     self.assertFalse(('[email protected]', 'n4') in email_list)  # comment author
     self.assertFalse(('[email protected]', 'n6') in email_list)
     email_list = c5.notification_list()
     self.assertFalse(('[email protected]', 'john') in email_list)
     self.assertTrue(('[email protected]', 'n4') in email_list)  # comment author
开发者ID:ErinCall,项目名称:flask-pycon2014,代码行数:28,代码来源:test_comment_model.py


注:本文中的app.models.Comment.notification_list方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。