test_config.py 文件源码

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

项目:two1-python 作者: 21dotco 项目源码 文件源码
def test_last_update_check_set():
    """Asert last_update_check is set in a config with none."""
    mock_config = mock.mock_open(read_data=CONFIG_DATA)
    assert 'last_update_check' not in CONFIG_DATA
    with mock.patch('two1.commands.util.config.open', mock_config, create=True):
        conf = config.Config('config_file', check_update=True)
        # last_update_check should now be set after
        # initalizing the config object.
        assert hasattr(conf, 'last_update_check')
        assert 'last_update_check' in json.loads(
            mock_config.return_value.write.call_args[0][0])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号