diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_blob_client.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_blob_client.py
index db4273e7ee3a..cf3a3e371761 100644
--- a/sdk/storage/azure-storage-blob/azure/storage/blob/_blob_client.py
+++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_blob_client.py
@@ -1011,6 +1011,7 @@ def get_blob_properties(self, **kwargs):
except StorageErrorException as error:
process_storage_error(error)
blob_props.name = self.blob_name
+ blob_props.snapshot = self.snapshot
blob_props.container = self.container_name
return blob_props # type: ignore
diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_models.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_models.py
index 9324664eda68..5d46d0ffcfe4 100644
--- a/sdk/storage/azure-storage-blob/azure/storage/blob/_models.py
+++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_models.py
@@ -927,7 +927,7 @@ def from_string(cls, permission):
p_tag = 't' in permission
parsed = cls(read=p_read, write=p_write, delete=p_delete, list=p_list,
delete_previous_version=p_delete_previous_version, tag=p_tag)
- parsed._str = permission # pylint: disable = protected-access
+
return parsed
@@ -996,7 +996,7 @@ def from_string(cls, permission):
parsed = cls(read=p_read, add=p_add, create=p_create, write=p_write, delete=p_delete,
delete_previous_version=p_delete_previous_version, tag=p_tag)
- parsed._str = permission # pylint: disable = protected-access
+
return parsed
diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/models.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/models.py
index 27a9c9fe4a7f..c51356bd885f 100644
--- a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/models.py
+++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/models.py
@@ -386,7 +386,7 @@ def from_string(cls, permission):
parsed = cls(read=p_read, write=p_write, delete=p_delete, delete_previous_version=p_delete_previous_version,
list=p_list, add=p_add, create=p_create, update=p_update, process=p_process, tag=p_tag,
filter_by_tags=p_filter_by_tags)
- parsed._str = permission # pylint: disable = protected-access
+
return parsed
class Services(object):
diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_client_async.py b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_client_async.py
index d88075ae87b9..6b1454c4c6c6 100644
--- a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_client_async.py
+++ b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_client_async.py
@@ -540,6 +540,7 @@ async def get_blob_properties(self, **kwargs):
except StorageErrorException as error:
process_storage_error(error)
blob_props.name = self.blob_name
+ blob_props.snapshot = self.snapshot
blob_props.container = self.container_name
return blob_props # type: ignore
diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_container.test_list_blobs_with_include_metadata.yaml b/sdk/storage/azure-storage-blob/tests/recordings/test_container.test_list_blobs_with_include_metadata.yaml
new file mode 100644
index 000000000000..a57ab3cb9477
--- /dev/null
+++ b/sdk/storage/azure-storage-blob/tests/recordings/test_container.test_list_blobs_with_include_metadata.yaml
@@ -0,0 +1,246 @@
+interactions:
+- request:
+ body: null
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '0'
+ User-Agent:
+ - azsdk-python-storage-blob/12.4.0 Python/3.7.3 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Fri, 21 Aug 2020 08:34:52 GMT
+ x-ms-version:
+ - '2019-12-12'
+ method: PUT
+ uri: https://storagename.blob.core.windows.net/container3851155b?restype=container
+ response:
+ body:
+ string: "\uFEFFContainerAlreadyExistsThe
+ specified container already exists.\nRequestId:4d6b1fbe-501e-0079-7c95-77b184000000\nTime:2020-08-21T08:34:52.7820585Z"
+ headers:
+ content-length:
+ - '230'
+ content-type:
+ - application/xml
+ date:
+ - Fri, 21 Aug 2020 08:34:52 GMT
+ server:
+ - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-error-code:
+ - ContainerAlreadyExists
+ x-ms-version:
+ - '2019-12-12'
+ status:
+ code: 409
+ message: The specified container already exists.
+- request:
+ body: hello world
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '11'
+ Content-Type:
+ - application/octet-stream
+ User-Agent:
+ - azsdk-python-storage-blob/12.4.0 Python/3.7.3 (Windows-10-10.0.18362-SP0)
+ x-ms-blob-content-disposition:
+ - inline
+ x-ms-blob-content-language:
+ - spanish
+ x-ms-blob-type:
+ - BlockBlob
+ x-ms-date:
+ - Fri, 21 Aug 2020 08:34:52 GMT
+ x-ms-meta-name:
+ - bob
+ x-ms-meta-number:
+ - '1'
+ x-ms-version:
+ - '2019-12-12'
+ method: PUT
+ uri: https://storagename.blob.core.windows.net/container3851155b/blob1
+ response:
+ body:
+ string: ''
+ headers:
+ content-length:
+ - '0'
+ content-md5:
+ - XrY7u+Ae7tCTyyK7j1rNww==
+ date:
+ - Fri, 21 Aug 2020 08:34:52 GMT
+ etag:
+ - '"0x8D845AD135C55E0"'
+ last-modified:
+ - Fri, 21 Aug 2020 08:34:52 GMT
+ server:
+ - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-content-crc64:
+ - vo7q9sPVKY0=
+ x-ms-request-server-encrypted:
+ - 'true'
+ x-ms-version:
+ - '2019-12-12'
+ x-ms-version-id:
+ - '2020-08-21T08:34:52.9412336Z'
+ status:
+ code: 201
+ message: Created
+- request:
+ body: null
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '0'
+ User-Agent:
+ - azsdk-python-storage-blob/12.4.0 Python/3.7.3 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Fri, 21 Aug 2020 08:34:53 GMT
+ x-ms-version:
+ - '2019-12-12'
+ method: PUT
+ uri: https://storagename.blob.core.windows.net/container3851155b/blob1?comp=snapshot
+ response:
+ body:
+ string: ''
+ headers:
+ content-length:
+ - '0'
+ date:
+ - Fri, 21 Aug 2020 08:34:52 GMT
+ etag:
+ - '"0x8D845AD135C55E0"'
+ last-modified:
+ - Fri, 21 Aug 2020 08:34:52 GMT
+ server:
+ - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-request-server-encrypted:
+ - 'false'
+ x-ms-snapshot:
+ - '2020-08-21T08:34:53.0423049Z'
+ x-ms-version:
+ - '2019-12-12'
+ x-ms-version-id:
+ - '2020-08-21T08:34:53.0433049Z'
+ status:
+ code: 201
+ message: Created
+- request:
+ body: hello world
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '11'
+ Content-Type:
+ - application/octet-stream
+ User-Agent:
+ - azsdk-python-storage-blob/12.4.0 Python/3.7.3 (Windows-10-10.0.18362-SP0)
+ x-ms-blob-content-disposition:
+ - inline
+ x-ms-blob-content-language:
+ - spanish
+ x-ms-blob-type:
+ - BlockBlob
+ x-ms-date:
+ - Fri, 21 Aug 2020 08:34:53 GMT
+ x-ms-meta-name:
+ - car
+ x-ms-meta-number:
+ - '2'
+ x-ms-version:
+ - '2019-12-12'
+ method: PUT
+ uri: https://storagename.blob.core.windows.net/container3851155b/blob2
+ response:
+ body:
+ string: ''
+ headers:
+ content-length:
+ - '0'
+ content-md5:
+ - XrY7u+Ae7tCTyyK7j1rNww==
+ date:
+ - Fri, 21 Aug 2020 08:34:52 GMT
+ etag:
+ - '"0x8D845AD137CDC23"'
+ last-modified:
+ - Fri, 21 Aug 2020 08:34:53 GMT
+ server:
+ - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-content-crc64:
+ - vo7q9sPVKY0=
+ x-ms-request-server-encrypted:
+ - 'true'
+ x-ms-version:
+ - '2019-12-12'
+ x-ms-version-id:
+ - '2020-08-21T08:34:53.1543859Z'
+ status:
+ code: 201
+ message: Created
+- request:
+ body: null
+ headers:
+ Accept:
+ - application/xml
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ User-Agent:
+ - azsdk-python-storage-blob/12.4.0 Python/3.7.3 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Fri, 21 Aug 2020 08:34:53 GMT
+ x-ms-version:
+ - '2019-12-12'
+ method: GET
+ uri: https://storagename.blob.core.windows.net/container3851155b?include=metadata&restype=container&comp=list
+ response:
+ body:
+ string: "\uFEFFblob12020-08-21T08:34:53.0433049ZtrueFri,
+ 21 Aug 2020 08:34:52 GMTFri, 21 Aug 2020 08:34:52
+ GMT0x8D845AD135C55E011application/octet-streamspanishXrY7u+Ae7tCTyyK7j1rNww==inlineBlockBlobHottrueunlockedavailabletrue1bobblob22020-08-21T08:34:53.1543859ZtrueFri,
+ 21 Aug 2020 08:34:53 GMTFri, 21 Aug 2020 08:34:53
+ GMT0x8D845AD137CDC2311application/octet-streamspanishXrY7u+Ae7tCTyyK7j1rNww==inlineBlockBlobHottrueunlockedavailabletrue2car"
+ headers:
+ content-type:
+ - application/xml
+ date:
+ - Fri, 21 Aug 2020 08:34:52 GMT
+ server:
+ - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
+ transfer-encoding:
+ - chunked
+ x-ms-version:
+ - '2019-12-12'
+ status:
+ code: 200
+ message: OK
+version: 1
diff --git a/sdk/storage/azure-storage-blob/tests/test_common_blob.py b/sdk/storage/azure-storage-blob/tests/test_common_blob.py
index cd53a51c8c8a..aca40681a062 100644
--- a/sdk/storage/azure-storage-blob/tests/test_common_blob.py
+++ b/sdk/storage/azure-storage-blob/tests/test_common_blob.py
@@ -193,10 +193,11 @@ def test_blob_snapshot_exists(self, resource_group, location, storage_account, s
# Act
blob = self.bsc.get_blob_client(self.container_name, blob_name, snapshot=snapshot)
- exists = blob.get_blob_properties()
+ prop = blob.get_blob_properties()
# Assert
- self.assertTrue(exists)
+ self.assertTrue(prop)
+ self.assertEqual(snapshot['snapshot'], prop.snapshot)
@GlobalStorageAccountPreparer()
@@ -2307,7 +2308,7 @@ def test_set_blob_permission(self):
self.assertEqual(permission.read, True)
self.assertEqual(permission.delete, True)
self.assertEqual(permission.write, True)
- self.assertEqual(permission._str, 'wrdx')
+ self.assertEqual(permission._str, 'rwdx')
@GlobalStorageAccountPreparer()
def test_transport_closed_only_once(self, resource_group, location, storage_account, storage_account_key):
diff --git a/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py b/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py
index b2a7bc6235d8..fcaefbfcfe42 100644
--- a/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py
+++ b/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py
@@ -220,10 +220,11 @@ async def test_blob_snapshot_exists(self, resource_group, location, storage_acco
# Act
blob = self.bsc.get_blob_client(self.container_name, blob_name, snapshot=snapshot)
- exists = await blob.get_blob_properties()
+ prop = await blob.get_blob_properties()
# Assert
- self.assertTrue(exists)
+ self.assertTrue(prop)
+ self.assertEqual(snapshot['snapshot'], prop.snapshot)
@GlobalStorageAccountPreparer()
diff --git a/sdk/storage/azure-storage-blob/tests/test_container.py b/sdk/storage/azure-storage-blob/tests/test_container.py
index 5e182af618b1..a0903a6470f5 100644
--- a/sdk/storage/azure-storage-blob/tests/test_container.py
+++ b/sdk/storage/azure-storage-blob/tests/test_container.py
@@ -25,7 +25,7 @@
PremiumPageBlobTier,
generate_container_sas,
PartialBatchErrorException,
- generate_account_sas, ResourceTypes, AccountSasPermissions, ContainerClient)
+ generate_account_sas, ResourceTypes, AccountSasPermissions, ContainerClient, ContentSettings)
#------------------------------------------------------------------------------
TEST_CONTAINER_PREFIX = 'container'
@@ -974,13 +974,17 @@ def test_list_blobs_with_include_snapshots(self, resource_group, location, stora
@GlobalStorageAccountPreparer()
def test_list_blobs_with_include_metadata(self, resource_group, location, storage_account, storage_account_key):
bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key)
- pytest.skip("Waiting on metadata XML fix in msrest")
+ # pytest.skip("Waiting on metadata XML fix in msrest")
container = self._create_container(bsc)
data = b'hello world'
+ content_settings = ContentSettings(
+ content_language='spanish',
+ content_disposition='inline')
blob1 = container.get_blob_client('blob1')
- blob1.upload_blob(data, metadata={'number': '1', 'name': 'bob'})
+ blob1.upload_blob(data, overwrite=True, content_settings=content_settings, metadata={'number': '1', 'name': 'bob'})
blob1.create_snapshot()
- container.get_blob_client('blob2').upload_blob(data, metadata={'number': '2', 'name': 'car'})
+
+ container.get_blob_client('blob2').upload_blob(data, overwrite=True, content_settings=content_settings, metadata={'number': '2', 'name': 'car'})
# Act
blobs =list(container.list_blobs(include="metadata"))
@@ -993,6 +997,8 @@ def test_list_blobs_with_include_metadata(self, resource_group, location, storag
self.assertEqual(blobs[1].name, 'blob2')
self.assertEqual(blobs[1].metadata['number'], '2')
self.assertEqual(blobs[1].metadata['name'], 'car')
+ self.assertEqual(blobs[1].content_settings.content_language, 'spanish')
+ self.assertEqual(blobs[1].content_settings.content_disposition, 'inline')
@GlobalStorageAccountPreparer()
def test_list_blobs_with_include_uncommittedblobs(self, resource_group, location, storage_account, storage_account_key):
@@ -1700,7 +1706,7 @@ def test_set_container_permission(self):
self.assertEqual(permission.read, True)
self.assertEqual(permission.list, True)
self.assertEqual(permission.write, True)
- self.assertEqual(permission._str, 'wrlx')
+ self.assertEqual(permission._str, 'rwxl')
@GlobalStorageAccountPreparer()
def test_download_blob(self, resource_group, location, storage_account, storage_account_key):
diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/models.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/models.py
index 6919763977d1..0aeb96a8aea7 100644
--- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/models.py
+++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/models.py
@@ -387,7 +387,7 @@ def from_string(cls, permission):
parsed = cls(read=p_read, write=p_write, delete=p_delete, delete_previous_version=p_delete_previous_version,
list=p_list, add=p_add, create=p_create, update=p_update, process=p_process, tag=p_tag,
filter_by_tags=p_filter_by_tags)
- parsed._str = permission # pylint: disable = protected-access
+
return parsed
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_models.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_models.py
index 2d348d67d43a..17b5425b65cf 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_models.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_models.py
@@ -773,7 +773,7 @@ def from_string(cls, permission):
p_delete = 'd' in permission
parsed = cls(p_read, p_create, p_write, p_delete)
- parsed._str = permission # pylint: disable = protected-access
+
return parsed
@@ -830,7 +830,7 @@ def from_string(cls, permission):
p_list = 'l' in permission
parsed = cls(p_read, p_write, p_delete, p_list)
- parsed._str = permission # pylint: disable = protected-access
+
return parsed
class NTFSAttributes(object):
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/models.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/models.py
index aa31bfbbc955..27cd2360f81c 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/models.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/models.py
@@ -387,7 +387,7 @@ def from_string(cls, permission):
parsed = cls(read=p_read, write=p_write, delete=p_delete, delete_previous_version=p_delete_previous_version,
list=p_list, add=p_add, create=p_create, update=p_update, process=p_process, tag=p_tag,
filter_by_tags=p_filter_by_tags)
- parsed._str = permission # pylint: disable = protected-access
+
return parsed
diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_models.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_models.py
index 8fc8a305222a..24d3b4bea627 100644
--- a/sdk/storage/azure-storage-queue/azure/storage/queue/_models.py
+++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_models.py
@@ -409,7 +409,7 @@ def from_string(cls, permission):
p_process = 'p' in permission
parsed = cls(p_read, p_add, p_update, p_process)
- parsed._str = permission # pylint: disable = protected-access
+
return parsed
diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/models.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/models.py
index 624449250463..4a8d4a3dc513 100644
--- a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/models.py
+++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/models.py
@@ -387,7 +387,7 @@ def from_string(cls, permission):
parsed = cls(read=p_read, write=p_write, delete=p_delete, delete_previous_version=p_delete_previous_version,
list=p_list, add=p_add, create=p_create, update=p_update, process=p_process, tag=p_tag,
filter_by_tags=p_filter_by_tags)
- parsed._str = permission # pylint: disable = protected-access
+
return parsed