Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sdk/storage/azure-storage-blob/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
**New features**
- Added SAS support for snapshot and identity.
- Distributed tracing framework OpenCensus is now supported.
- Added support for append block from URL for append blobs.
- Added support for update page from URL for page blobs.
- Added support for append_block_from_url API for append blobs.
- Added support for upload_pages_from_url API for page blobs.
- Added support for client provided encryption key to numerous APIs.

**Dependency updates**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ def _download_blob_options(self, offset=None, length=None, validate_content=Fals
if self.require_encryption and not self.key_encryption_key:
raise ValueError("Encryption required but no key was provided.")
if length is not None and offset is None:
raise ValueError("Offset value must not be None is length is set.")
raise ValueError("Offset value must not be None if length is set.")

access_conditions = get_access_conditions(kwargs.pop('lease', None))
mod_conditions = ModifiedAccessConditions(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ async def _test_append_block_from_url_with_if_modified(self):
await destination_blob_client.append_block_from_url(source_blob_client.url + '?' + sas,
source_range_start=0,
source_range_end=LARGE_BLOB_SIZE - 1,
if_modified_since=source_properties.get(
if_modified_since=destination_blob_properties.get(
'last_modified'))

@record
Expand Down Expand Up @@ -739,7 +739,7 @@ async def _test_append_block_from_url_with_if_unmodified(self):
await destination_blob_client.append_block_from_url(source_blob_client.url + '?' + sas,
source_range_start=0,
source_range_end=LARGE_BLOB_SIZE - 1,
if_unmodified_since=source_properties.get(
if_unmodified_since=destination_blob_properties.get(
'last_modified') - timedelta(minutes=15))

@record
Expand Down
31 changes: 16 additions & 15 deletions sdk/storage/azure-storage-blob/tests/test_common_blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -863,21 +863,22 @@ def test_copy_blob_with_existing_blob(self):
copy_content = copyblob.download_blob().content_as_bytes()
self.assertEqual(copy_content, self.byte_data)

@record
def test_copy_blob_with_external_blob_fails(self):
# Arrange
source_blob = "http://www.gutenberg.org/files/59466/59466-0.txt"
copied_blob = self.bsc.get_blob_client(self.container_name, '59466-0.txt')

# Act
copy = copied_blob.start_copy_from_url(source_blob)
self.assertEqual(copy['copy_status'], 'pending')
props = self._wait_for_async_copy(copied_blob)

# Assert
self.assertEqual(props.copy.status_description, '500 InternalServerError "Copy failed."')
self.assertEqual(props.copy.status, 'failed')
self.assertIsNotNone(props.copy.id)
# TODO: external copy was supported since 2019-02-02
# @record
# def test_copy_blob_with_external_blob_fails(self):
# # Arrange
# source_blob = "http://www.google.com"
# copied_blob = self.bsc.get_blob_client(self.container_name, '59466-0.txt')
#
# # Act
# copy = copied_blob.start_copy_from_url(source_blob)
# self.assertEqual(copy['copy_status'], 'pending')
# props = self._wait_for_async_copy(copied_blob)
#
# # Assert
# self.assertEqual(props.copy.status_description, '500 InternalServerError "Copy failed."')
# self.assertEqual(props.copy.status, 'success')
# self.assertIsNotNone(props.copy.id)

@record
def test_copy_blob_async_private_blob_no_sas(self):
Expand Down
41 changes: 21 additions & 20 deletions sdk/storage/azure-storage-blob/tests/test_common_blob_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -1146,26 +1146,27 @@ def test_copy_blob_with_existing_blob(self):
loop = asyncio.get_event_loop()
loop.run_until_complete(self._test_copy_blob_with_existing_blob())

async def _test_copy_blob_with_external_blob_fails(self):
# Arrange
await self._setup()
source_blob = "http://www.gutenberg.org/files/59466/59466-0.txt"
copied_blob = self.bsc.get_blob_client(self.container_name, '59466-0.txt')

# Act
copy = await copied_blob.start_copy_from_url(source_blob)
self.assertEqual(copy['copy_status'], 'pending')
props = await self._wait_for_async_copy(copied_blob)

# Assert
self.assertEqual(props.copy.status_description, '500 InternalServerError "Copy failed."')
self.assertEqual(props.copy.status, 'failed')
self.assertIsNotNone(props.copy.id)

@record
def test_copy_blob_with_external_blob_fails(self):
loop = asyncio.get_event_loop()
loop.run_until_complete(self._test_copy_blob_with_external_blob_fails())
# TODO: external copy was supported since 2019-02-02
# async def _test_copy_blob_with_external_blob_fails(self):
# # Arrange
# await self._setup()
# source_blob = "http://www.gutenberg.org/files/59466/59466-0.txt"
# copied_blob = self.bsc.get_blob_client(self.container_name, '59466-0.txt')
#
# # Act
# copy = await copied_blob.start_copy_from_url(source_blob)
# self.assertEqual(copy['copy_status'], 'pending')
# props = await self._wait_for_async_copy(copied_blob)
#
# # Assert
# self.assertEqual(props.copy.status_description, '500 InternalServerError "Copy failed."')
# self.assertEqual(props.copy.status, 'failed')
# self.assertIsNotNone(props.copy.id)
#
# @record
# def test_copy_blob_with_external_blob_fails(self):
# loop = asyncio.get_event_loop()
# loop.run_until_complete(self._test_copy_blob_with_external_blob_fails())

async def _test_copy_blob_async_private_blob_no_sas(self):
# Arrange
Expand Down
2 changes: 0 additions & 2 deletions sdk/storage/azure-storage-file/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
## Version 12.0.0b3:

**New features**
- Added FileSmbProperties REST Parity.
- Added support for PutRangeThroughURL.
- Added upload_range_from_url API to write the bytes from one Azure File endpoint into the specified range of another Azure File endpoint.
- Added set_http_headers for directory_client, create_permission_for_share and get_permission_for_share APIs.
- Added optional parameters for smb properties related parameters for create_file*, create_directory* related APIs and set_http_headers API.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ async def download_file(
if self.require_encryption or (self.key_encryption_key is not None):
raise ValueError("Encryption not supported.")
if length is not None and offset is None:
raise ValueError("Offset value must not be None is length is set.")
raise ValueError("Offset value must not be None if length is set.")

downloader = StorageStreamDownloader(
service=self._client.file,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ def download_file(
if self.require_encryption or (self.key_encryption_key is not None):
raise ValueError("Encryption not supported.")
if length is not None and offset is None:
raise ValueError("Offset value must not be None is length is set.")
raise ValueError("Offset value must not be None if length is set.")

return StorageStreamDownloader(
service=self._client.file,
Expand Down