test_all_users_listing.py 文件源码

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

项目:Cycling_admin 作者: Social-projects-Rivne 项目源码 文件源码
def test_controller_with_empty_db(self, db):
        """
        Imitate situation when there is no any user available in the db and
        sqlalchemy output becomes an empty list []. Message 'There are no
        users in the database' instead of users table is expected as default
        behavior in this case.
        """
        db.session.query.return_value.all.return_value = []
        with app.test_client() as test_client:
            responce = test_client.get('/users/all')
            data = responce.data
            self.assertIn('There are no users in the database.', data)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号