Пример #1
0
    def test_download_by_id_progress_partial_shifted_overwrite(self):
        # LOCAL is
        # 12345678901234567890
        #
        # and then:
        #
        # hello world
        #    |||||||
        #    \\\\\\\
        #     \\\\\\\
        #      \\\\\\\
        #       \\\\\\\
        #        \\\\\\\
        #        |||||||
        #        vvvvvvv
        #
        # 1234567lo worl567890

        with TempDir() as d:
            path = os.path.join(d, 'file2')
            download_dest = PreSeekedDownloadDest(seek_target=7,
                                                  local_file_path=path)
            data = six.b('12345678901234567890')
            write_file(path, data)
            self.bucket.download_file_by_id(
                self.file_info.id_,
                download_dest,
                self.progress_listener,
                range_=(3, 9),
            )
            self._check_local_file_contents(path,
                                            six.b('1234567lo worl567890'))
Пример #2
0
 def _make_dest(self, temp_dir):
     file_path = os.path.join(temp_dir, "test.txt")
     with open(file_path, 'wb') as f:
         f.write(six.b('12345678901234567890'))
     return PreSeekedDownloadDest(local_file_path=file_path,
                                  seek_target=3), file_path