def test_delete_passes_if_os_exeception(self, mock_open):
resource_id = str(uuid.uuid4())
path = '/doesnt_exist/resources/{}/{}/{}'.format(
resource_id[0:3], resource_id[3:6], resource_id[6:]
)
patcher = fake_filesystem_unittest.Patcher()
patcher.setUp()
patcher.fs.CreateFile(path)
assert os.path.exists(path)
with mock.patch('ckanext.validation.utils.os.remove',
side_effect=OSError):
delete_local_uploaded_file(resource_id)
patcher.tearDown()
评论列表
文章目录