def process_chunk(self, base_url, auth, issue_key, buf, lock, progress, count): index = next(count) etag = FileService.generate_etag(buf) response = self.check_if_chunk_exists(base_url, auth, issue_key, [etag]) if not response["data"]["results"][etag]["exists"]: self.upload_chunk(base_url, auth, issue_key, etag, buf) with lock: progress.update(1) return etag, index
def test_generate_etag(self): expected_etag = 'a17c9aaa61e80a1bf71d0d850af4e5baa9800bbd-4' actual_etag = FileService.generate_etag(b'data') self.assertEqual(expected_etag, actual_etag)