test_config.py 文件源码

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

项目:two1-python 作者: 21dotco 项目源码 文件源码
def test_prompts_update_needed():
    """Test Config object will suggest update if needed."""
    tmp_config_data = json.loads(CONFIG_DATA)
    # set an old timestamp
    tmp_config_data['last_update_check'] = 0.0
    mock_config = mock.mock_open(read_data=json.dumps(tmp_config_data))
    with mock.patch('two1.commands.util.config.Config.save', return_value=None):
        with mock.patch('two1.commands.util.config.open', mock_config, create=True):
            with capture_stderr(
                    config.Config, 'config_file', check_update=True) as output:
                output = output.strip()
                assert(len(output) > 0)
                assert(output in uxstring.UxString.update_required)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号