Example #1
0
 def _hashing_subtest(self, *, threshold, chunksize, data=data):
     with self.s3_test_multi_thread_download(self.bucket,
                                             self.key,
                                             data,
                                             threshold=threshold,
                                             chunksize=chunksize):
         assert data_transfer.calculate_sha256([self.src], [self.size]) == [
             self.hasher(self.data).hexdigest()
         ]
Example #2
0
    def test_calculate_sha256_read_timeout(self):
        bucket = 'test-bucket'
        key = 'dir/a'
        vid = 'a1234'

        a_contents = b'a' * 10

        pk = PhysicalKey(bucket, key, vid)
        with mock.patch('botocore.client.BaseClient._make_api_call',
                        side_effect=ReadTimeoutError('Error Uploading', endpoint_url="s3://foobar")):
            results = data_transfer.calculate_sha256([pk], [len(a_contents)])
            assert list(results) == [None]
Example #3
0
    def test_calculate_sha256_read_timeout(self, mocked_api_call):
        bucket = 'test-bucket'
        key = 'dir/a'
        vid = 'a1234'

        a_contents = b'a' * 10

        pk = PhysicalKey(bucket, key, vid)
        exc = ReadTimeoutError('Error Uploading', endpoint_url="s3://foobar")
        mocked_api_call.side_effect = exc
        results = data_transfer.calculate_sha256([pk], [len(a_contents)])
        assert mocked_api_call.call_count == data_transfer.MAX_FIX_HASH_RETRIES
        assert results == [exc]