当前位置: 首页>>代码示例>>Python>>正文


Python OrphanManager.delete_orphaned_file方法代码示例

本文整理汇总了Python中pulp.server.managers.content.orphan.OrphanManager.delete_orphaned_file方法的典型用法代码示例。如果您正苦于以下问题:Python OrphanManager.delete_orphaned_file方法的具体用法?Python OrphanManager.delete_orphaned_file怎么用?Python OrphanManager.delete_orphaned_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pulp.server.managers.content.orphan.OrphanManager的用法示例。


在下文中一共展示了OrphanManager.delete_orphaned_file方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_clean_non_root

# 需要导入模块: from pulp.server.managers.content.orphan import OrphanManager [as 别名]
# 或者: from pulp.server.managers.content.orphan.OrphanManager import delete_orphaned_file [as 别名]
    def test_clean_non_root(
            self,
            listdir,
            access,
            is_shared,
            unlink_shared,
            delete,
            config,
            rmdir,
            lexists):
        """
        Ensure that empty directories more than 1 level up from root are removed.
        """
        listdir.return_value = None
        access.return_value = True
        path = '/storage/pulp/content/test/lvl1/lvl2/thing.remove'
        storage_dir = '/storage/pulp'
        is_shared.return_value = False
        config.get.return_value = storage_dir
        lexists.return_value = True

        OrphanManager.delete_orphaned_file(path)
        rmdir.assert_has_calls(
            [
                call('/storage/pulp/content/test/lvl1/lvl2'),
                call('/storage/pulp/content/test/lvl1')
            ])
开发者ID:pulp,项目名称:pulp,代码行数:29,代码来源:test_orphan.py

示例2: test_path_not_exists

# 需要导入模块: from pulp.server.managers.content.orphan import OrphanManager [as 别名]
# 或者: from pulp.server.managers.content.orphan.OrphanManager import delete_orphaned_file [as 别名]
    def test_path_not_exists(self, is_shared, unlink_shared, delete, config, rmdir, lexists):
        lexists.return_value = False
        path = '/tmp/path-1'

        # test
        OrphanManager.delete_orphaned_file(path)

        # validation
        lexists.assert_called_once_with(path)
        self.assertFalse(is_shared.called)
        self.assertFalse(delete.called)
        self.assertFalse(rmdir.called)
        self.assertFalse(unlink_shared.called)
开发者ID:pulp,项目名称:pulp,代码行数:15,代码来源:test_orphan.py

示例3: test_clean_no_access

# 需要导入模块: from pulp.server.managers.content.orphan import OrphanManager [as 别名]
# 或者: from pulp.server.managers.content.orphan.OrphanManager import delete_orphaned_file [as 别名]
    def test_clean_no_access(self, mls, maccess, is_shared, unlink_shared, delete, config, m_rmdir):
        """
        Ensure that rmdir is not called when user does not have access to dir.
        """
        mls.return_value = None
        maccess.return_value = False
        path = '/storage/pulp/content/test/lvl1/lvl2/thing.remove'
        storage_dir = '/storage/pulp'
        is_shared.return_value = False
        config.get.return_value = storage_dir

        OrphanManager.delete_orphaned_file(path)
        self.assertFalse(m_rmdir.called)
开发者ID:aeria,项目名称:pulp,代码行数:15,代码来源:test_orphan.py

示例4: test_not_shared

# 需要导入模块: from pulp.server.managers.content.orphan import OrphanManager [as 别名]
# 或者: from pulp.server.managers.content.orphan.OrphanManager import delete_orphaned_file [as 别名]
    def test_not_shared(self, is_shared, unlink_shared, delete, config):
        path = '/path-1'
        storage_dir = '/storage/pulp/dir'
        is_shared.return_value = False
        config.get.return_value = storage_dir

        # test
        OrphanManager.delete_orphaned_file(path)

        # validation
        is_shared.assert_called_once_with(storage_dir, path)
        delete.assert_called_once_with(path)
        self.assertFalse(unlink_shared.called)
开发者ID:maxamillion,项目名称:pulp,代码行数:15,代码来源:test_orphan.py

示例5: test_clean_nonempty

# 需要导入模块: from pulp.server.managers.content.orphan import OrphanManager [as 别名]
# 或者: from pulp.server.managers.content.orphan.OrphanManager import delete_orphaned_file [as 别名]
    def test_clean_nonempty(self, mls, maccess, is_shared, unlink_shared, delete, config, m_rmdir):
        """
        Ensure that nonempty directories are not removed.
        """
        mls.return_value = ['some', 'files']
        maccess.return_value = True
        path = '/storage/pulp/content/test/lvl1/lvl2/thing.remove'
        storage_dir = '/storage/pulp'
        is_shared.return_value = False
        config.get.return_value = storage_dir

        OrphanManager.delete_orphaned_file(path)
        self.assertFalse(m_rmdir.called)
开发者ID:aeria,项目名称:pulp,代码行数:15,代码来源:test_orphan.py


注:本文中的pulp.server.managers.content.orphan.OrphanManager.delete_orphaned_file方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。