test_utils.py 文件源码

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

项目:ckanext-validation 作者: frictionlessdata 项目源码 文件源码
def test_delete_file_not_deleted_if_resources_first(self, mock_open):

        resource_id = str(uuid.uuid4())
        path = '/doesnt_exist/resources/{}'.format(resource_id)

        patcher = fake_filesystem_unittest.Patcher()
        patcher.setUp()
        patcher.fs.CreateFile(path)

        assert os.path.exists(path)
        with mock.patch('ckanext.validation.utils.get_local_upload_path',
                        return_value=path):
            delete_local_uploaded_file(resource_id)

        assert not os.path.exists(path)
        assert os.path.exists('/doesnt_exist/resources')

        patcher.tearDown()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号