def test_progress_logging(self):
self.mock_swift.download.return_value = [
{
'action': 'download_object',
'read_length': 100
}
for i in range(20)
]
self.mock_swift.download.return_value.append({'action': 'random_action'})
swift_p = SwiftPath('swift://tenant/container')
with LogCapture('stor.swift.progress') as progress_log:
swift_p.download('output_dir')
progress_log.check(
('stor.swift.progress', 'INFO', 'starting download'),
('stor.swift.progress', 'INFO', '10\t0:00:00\t0.00 MB\t0.00 MB/s'), # nopep8
('stor.swift.progress', 'INFO', '20\t0:00:00\t0.00 MB\t0.00 MB/s'), # nopep8
('stor.swift.progress', 'INFO', 'download complete - 20\t0:00:00\t0.00 MB\t0.00 MB/s'), # nopep8
)
评论列表
文章目录