test_ajax_notifications.py 文件源码

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

项目:dbas 作者: hhucn 项目源码 文件源码
def test_send_notification(self):
        self.config.testing_securitypolicy(userid='Tobias', permissive=True)
        from dbas.views import send_some_notification as ajax
        db_len1 = len(DBDiscussionSession.query(Message).filter(and_(Message.topic == 'Some text for a message',
                                                                     Message.content == 'Some text for a message')).all())
        request = testing.DummyRequest(params={
            'recipient': 'Christian',
            'title': 'Some text for a message',
            'text': 'Some text for a message',
        }, matchdict={})
        response = ajax(request)
        db_len2 = len(DBDiscussionSession.query(Message).filter(and_(Message.topic == 'Some text for a message',
                                                                     Message.content == 'Some text for a message')).all())
        self.assertIsNotNone(response)
        self.assertTrue(len(response['error']) == 0)
        self.assertTrue(db_len1 != db_len2)
        DBDiscussionSession.query(Message).filter(and_(Message.topic == 'Some text for a message',
                                                       Message.content == 'Some text for a message')).delete()
        transaction.commit()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号