stub.py 文件源码

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

项目:bootstrap-py 作者: mkouhei 项目源码 文件源码
def stub_request_metadata(badge=False):
    """stub request classifiers, badge."""
    if badge:
        with requests_mock.Mocker() as mock:
            with open('bootstrap_py/tests/data/badge.svg') as fobj:
                svg_data = fobj.read()
                mock.get(Update.badge_url,
                         text=svg_data,
                         status_code=200)

    with requests_mock.Mocker() as mock:
        with open('bootstrap_py/data/classifiers.txt') as fobj:
            data = fobj.read()
            mock.get(Classifiers.url,
                     text=data,
                     status_code=200)
            return Classifiers()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号