diff --git a/azure-storage-common/azure/storage/common/_deserialization.py b/azure-storage-common/azure/storage/common/_deserialization.py index 622197da..986d2647 100644 --- a/azure-storage-common/azure/storage/common/_deserialization.py +++ b/azure-storage-common/azure/storage/common/_deserialization.py @@ -56,6 +56,7 @@ def _get_download_size(start_range, end_range, resource_size): 'content-range': (None, 'content_range', _to_str), 'x-ms-blob-sequence-number': (None, 'page_blob_sequence_number', _to_int), 'x-ms-blob-committed-block-count': (None, 'append_blob_committed_block_count', _to_int), + 'x-ms-blob-public-access': (None, 'public_access', _to_str), 'x-ms-access-tier': (None, 'blob_tier', _to_str), 'x-ms-access-tier-change-time': (None, 'blob_tier_change_time', parser.parse), 'x-ms-access-tier-inferred': (None, 'blob_tier_inferred', _bool), diff --git a/tests/blob/test_container.py b/tests/blob/test_container.py index 4f7ccba7..da329b7f 100644 --- a/tests/blob/test_container.py +++ b/tests/blob/test_container.py @@ -7,26 +7,13 @@ # -------------------------------------------------------------------------- import requests from datetime import datetime, timedelta -from azure.common import ( - AzureHttpError, - AzureConflictHttpError, - AzureMissingResourceHttpError, - AzureException, -) -from azure.storage.common import ( - AccessPolicy, -) -from azure.storage.blob import ( - BlockBlobService, - ContainerPermissions, - Include, - PublicAccess, -) -from tests.testcase import ( - StorageTestCase, - TestMode, - record, -) +from azure.common import (AzureConflictHttpError, AzureException, + AzureHttpError, AzureMissingResourceHttpError) +from azure.storage.blob import (BlockBlobService, ContainerPermissions, + Include, PublicAccess) +from azure.storage.common import AccessPolicy + +from tests.testcase import StorageTestCase, TestMode, record #------------------------------------------------------------------------------ TEST_CONTAINER_PREFIX = 'container' @@ -368,6 +355,7 @@ def test_get_container_properties(self): container_name = self._create_container() self.bs.set_container_metadata(container_name, metadata) self.bs.acquire_container_lease(container_name) + self.bs.set_container_acl(container_name, None, 'container') # Act props = self.bs.get_container_properties(container_name) @@ -378,6 +366,7 @@ def test_get_container_properties(self): self.assertEqual(props.properties.lease.duration, 'infinite') self.assertEqual(props.properties.lease.state, 'leased') self.assertEqual(props.properties.lease.status, 'locked') + self.assertEqual(props.properties.public_access, 'container') @record def test_get_container_properties_with_lease_id(self): diff --git a/tests/recordings/test_container.test_get_container_properties.yaml b/tests/recordings/test_container.test_get_container_properties.yaml index 23b04756..444e97cd 100644 --- a/tests/recordings/test_container.test_get_container_properties.yaml +++ b/tests/recordings/test_container.test_get_container_properties.yaml @@ -4,21 +4,21 @@ interactions: headers: Connection: [keep-alive] Content-Length: ['0'] - User-Agent: [Azure-Storage/1.1.0-1.1.0 (Python CPython 3.6.3; Darwin 17.3.0)] - x-ms-client-request-id: [7bcf33ee-0acb-11e8-89b0-b8e8564491f6] - x-ms-date: ['Mon, 05 Feb 2018 23:22:50 GMT'] + User-Agent: [Azure-Storage/1.1.0-1.1.0 (Python CPython 3.6.2; Windows 10)] + x-ms-client-request-id: [38906c82-226a-11e8-8f5a-c8d3ffb16a1d] + x-ms-date: ['Thu, 08 Mar 2018 00:47:04 GMT'] x-ms-version: ['2017-07-29'] method: PUT uri: https://storagename.blob.core.windows.net/container9840123e?restype=container response: body: {string: ''} headers: - Date: ['Mon, 05 Feb 2018 23:22:49 GMT'] - ETag: ['"0x8D56CEF5FF9FB6E"'] - Last-Modified: ['Mon, 05 Feb 2018 23:22:50 GMT'] + Date: ['Thu, 08 Mar 2018 00:47:04 GMT'] + ETag: ['"0x8D5848E1CDBF6B8"'] + Last-Modified: ['Thu, 08 Mar 2018 00:47:04 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] - x-ms-request-id: [b553f7ed-001e-0102-42d8-9e107b000000] + x-ms-request-id: [cbf4af7b-501e-00cf-0e76-b66480000000] x-ms-version: ['2017-07-29'] status: {code: 201, message: Created} - request: @@ -26,9 +26,9 @@ interactions: headers: Connection: [keep-alive] Content-Length: ['0'] - User-Agent: [Azure-Storage/1.1.0-1.1.0 (Python CPython 3.6.3; Darwin 17.3.0)] - x-ms-client-request-id: [7be44b8a-0acb-11e8-bd7d-b8e8564491f6] - x-ms-date: ['Mon, 05 Feb 2018 23:22:50 GMT'] + User-Agent: [Azure-Storage/1.1.0-1.1.0 (Python CPython 3.6.2; Windows 10)] + x-ms-client-request-id: [38ad133a-226a-11e8-b87b-c8d3ffb16a1d] + x-ms-date: ['Thu, 08 Mar 2018 00:47:04 GMT'] x-ms-meta-hello: [world] x-ms-meta-number: ['42'] x-ms-version: ['2017-07-29'] @@ -37,12 +37,12 @@ interactions: response: body: {string: ''} headers: - Date: ['Mon, 05 Feb 2018 23:22:49 GMT'] - ETag: ['"0x8D56CEF600197C2"'] - Last-Modified: ['Mon, 05 Feb 2018 23:22:50 GMT'] + Date: ['Thu, 08 Mar 2018 00:47:04 GMT'] + ETag: ['"0x8D5848E1CE7E872"'] + Last-Modified: ['Thu, 08 Mar 2018 00:47:04 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] - x-ms-request-id: [b553f80d-001e-0102-5dd8-9e107b000000] + x-ms-request-id: [cbf4af86-501e-00cf-1476-b66480000000] x-ms-version: ['2017-07-29'] status: {code: 200, message: OK} - request: @@ -50,9 +50,9 @@ interactions: headers: Connection: [keep-alive] Content-Length: ['0'] - User-Agent: [Azure-Storage/1.1.0-1.1.0 (Python CPython 3.6.3; Darwin 17.3.0)] - x-ms-client-request-id: [7bea8374-0acb-11e8-bf35-b8e8564491f6] - x-ms-date: ['Mon, 05 Feb 2018 23:22:50 GMT'] + User-Agent: [Azure-Storage/1.1.0-1.1.0 (Python CPython 3.6.2; Windows 10)] + x-ms-client-request-id: [38b6fe70-226a-11e8-8339-c8d3ffb16a1d] + x-ms-date: ['Thu, 08 Mar 2018 00:47:04 GMT'] x-ms-lease-action: [acquire] x-ms-lease-duration: ['-1'] x-ms-version: ['2017-07-29'] @@ -61,40 +61,63 @@ interactions: response: body: {string: ''} headers: - Date: ['Mon, 05 Feb 2018 23:22:49 GMT'] - ETag: ['"0x8D56CEF600197C2"'] - Last-Modified: ['Mon, 05 Feb 2018 23:22:50 GMT'] + Date: ['Thu, 08 Mar 2018 00:47:04 GMT'] + ETag: ['"0x8D5848E1CE7E872"'] + Last-Modified: ['Thu, 08 Mar 2018 00:47:04 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] - x-ms-lease-id: [927b2bcf-266a-4059-9833-23b53801599f] - x-ms-request-id: [b553f81c-001e-0102-68d8-9e107b000000] + x-ms-lease-id: [b8fd1570-c475-419a-8cac-08d299cfc232] + x-ms-request-id: [cbf4af8e-501e-00cf-1c76-b66480000000] x-ms-version: ['2017-07-29'] status: {code: 201, message: Created} - request: body: null headers: Connection: [keep-alive] - User-Agent: [Azure-Storage/1.1.0-1.1.0 (Python CPython 3.6.3; Darwin 17.3.0)] - x-ms-client-request-id: [7bf04bcc-0acb-11e8-b8f2-b8e8564491f6] - x-ms-date: ['Mon, 05 Feb 2018 23:22:50 GMT'] + Content-Length: ['0'] + User-Agent: [Azure-Storage/1.1.0-1.1.0 (Python CPython 3.6.2; Windows 10)] + x-ms-blob-public-access: [container] + x-ms-client-request-id: [38bf6d06-226a-11e8-8e8a-c8d3ffb16a1d] + x-ms-date: ['Thu, 08 Mar 2018 00:47:04 GMT'] + x-ms-version: ['2017-07-29'] + method: PUT + uri: https://storagename.blob.core.windows.net/container9840123e?restype=container&comp=acl + response: + body: {string: ''} + headers: + Date: ['Thu, 08 Mar 2018 00:47:04 GMT'] + ETag: ['"0x8D5848E1CF90289"'] + Last-Modified: ['Thu, 08 Mar 2018 00:47:04 GMT'] + Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] + Transfer-Encoding: [chunked] + x-ms-request-id: [cbf4af9b-501e-00cf-2776-b66480000000] + x-ms-version: ['2017-07-29'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Connection: [keep-alive] + User-Agent: [Azure-Storage/1.1.0-1.1.0 (Python CPython 3.6.2; Windows 10)] + x-ms-client-request-id: [38c81fe2-226a-11e8-8926-c8d3ffb16a1d] + x-ms-date: ['Thu, 08 Mar 2018 00:47:04 GMT'] x-ms-version: ['2017-07-29'] method: GET uri: https://storagename.blob.core.windows.net/container9840123e?restype=container response: body: {string: ''} headers: - Date: ['Mon, 05 Feb 2018 23:22:49 GMT'] - ETag: ['"0x8D56CEF600197C2"'] - Last-Modified: ['Mon, 05 Feb 2018 23:22:50 GMT'] + Date: ['Thu, 08 Mar 2018 00:47:04 GMT'] + ETag: ['"0x8D5848E1CF90289"'] + Last-Modified: ['Thu, 08 Mar 2018 00:47:04 GMT'] Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0] Transfer-Encoding: [chunked] - Vary: [Origin] + x-ms-blob-public-access: [container] x-ms-lease-duration: [infinite] x-ms-lease-state: [leased] x-ms-lease-status: [locked] x-ms-meta-hello: [world] x-ms-meta-number: ['42'] - x-ms-request-id: [b553f836-001e-0102-80d8-9e107b000000] + x-ms-request-id: [cbf4af9f-501e-00cf-2b76-b66480000000] x-ms-version: ['2017-07-29'] status: {code: 200, message: OK} version: 1