本文整理汇总了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')
])
示例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)
示例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)
示例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)
示例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)