test_utils.py 文件源码

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

项目:maas 作者: maas 项目源码 文件源码
def test__prints_textual_response_with_success_msg(self):
        # When the response has a status code of 2XX, and the response body is
        # textual print_response_content() will print a success message to the
        # TTY.
        status_code = random.randrange(200, 300)
        response = httplib2.Response({
            'status': status_code,
            'content': b"Lorem ipsum dolor sit amet.",
            'content-type': 'text/unicode',
            })
        buf = io.BytesIO()
        self.patch(buf, 'isatty').return_value = True
        utils.print_response_content(response, response['content'], buf)
        self.assertEqual(
            b"Success.\n"
            b"Machine-readable output follows:\n" +
            response['content'] + b"\n", buf.getvalue())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号