Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

edit all authentication files and add a test #13355

Merged
merged 3 commits into from
Aug 28, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ def _get_canonicalized_resource(self, request):
uri_path = urlparse(request.http_request.url).path
try:
if isinstance(request.context.transport, AioHttpTransport) or \
isinstance(getattr(request.context.transport, "_transport", None), AioHttpTransport):
isinstance(getattr(request.context.transport, "_transport", None), AioHttpTransport) or \
isinstance(getattr(getattr(request.context.transport, "_transport", None), "_transport", None),
AioHttpTransport):
uri_path = URL(uri_path)
return '/' + self.account_name + str(uri_path)
except TypeError:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
interactions:
- request:
body: null
headers:
User-Agent:
- azsdk-python-storage-blob/12.4.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Thu, 27 Aug 2020 01:48:41 GMT
x-ms-version:
- '2019-12-12'
method: PUT
uri: https://storagename.blob.core.windows.net/utcontainer775c1685?timeout=5&restype=container
response:
body:
string: ''
headers:
content-length: '0'
date: Thu, 27 Aug 2020 01:48:40 GMT
etag: '"0x8D84A2B5357BF80"'
last-modified: Thu, 27 Aug 2020 01:48:41 GMT
server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-version: '2019-12-12'
status:
code: 201
message: Created
url: https://emilyeuap.blob.core.windows.net/utcontainer775c1685?timeout=5&restype=container
- request:
body: ???
headers:
Content-Length:
- '3'
Content-Type:
- application/octet-stream
If-None-Match:
- '*'
User-Agent:
- azsdk-python-storage-blob/12.4.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0)
x-ms-blob-type:
- BlockBlob
x-ms-date:
- Thu, 27 Aug 2020 01:48:41 GMT
x-ms-version:
- '2019-12-12'
method: PUT
uri: https://storagename.blob.core.windows.net/utcontainer775c1685/=ques=tion!
response:
body:
string: ''
headers:
content-length: '0'
content-md5: DRsIw0hYkhvHxmKyKKy3ug==
date: Thu, 27 Aug 2020 01:48:40 GMT
etag: '"0x8D84A2B536556A6"'
last-modified: Thu, 27 Aug 2020 01:48:41 GMT
server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-content-crc64: VtoDJyOMw/A=
x-ms-request-server-encrypted: 'true'
x-ms-version: '2019-12-12'
x-ms-version-id: '2020-08-27T01:48:41.6124582Z'
status:
code: 201
message: Created
url: https://emilyeuap.blob.core.windows.net/utcontainer775c1685/=ques=tion!
- request:
body: null
headers:
Accept:
- application/xml
User-Agent:
- azsdk-python-storage-blob/12.4.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Thu, 27 Aug 2020 01:48:41 GMT
x-ms-range:
- bytes=0-33554431
x-ms-version:
- '2019-12-12'
method: GET
uri: https://storagename.blob.core.windows.net/utcontainer775c1685/=ques=tion!
response:
body:
string: ???
headers:
accept-ranges: bytes
content-length: '3'
content-range: bytes 0-2/3
content-type: application/octet-stream
date: Thu, 27 Aug 2020 01:48:41 GMT
etag: '"0x8D84A2B536556A6"'
last-modified: Thu, 27 Aug 2020 01:48:41 GMT
server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-blob-content-md5: DRsIw0hYkhvHxmKyKKy3ug==
x-ms-blob-type: BlockBlob
x-ms-creation-time: Thu, 27 Aug 2020 01:48:41 GMT
x-ms-is-current-version: 'true'
x-ms-lease-state: available
x-ms-lease-status: unlocked
x-ms-server-encrypted: 'true'
x-ms-version: '2019-12-12'
x-ms-version-id: '2020-08-27T01:48:41.6124582Z'
status:
code: 206
message: Partial Content
url: https://emilyeuap.blob.core.windows.net/utcontainer775c1685/=ques=tion!
version: 1
18 changes: 18 additions & 0 deletions sdk/storage/azure-storage-blob/tests/test_common_blob_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,24 @@ async def test_create_blob_with_question_mark(self, resource_group, location, st
content = data.decode('utf-8')
self.assertEqual(content, blob_data)

@GlobalStorageAccountPreparer()
@AsyncStorageTestCase.await_prepared_test
async def test_create_blob_with_equal_sign(self, resource_group, location, storage_account, storage_account_key):
# Arrange
await self._setup(storage_account, storage_account_key)
blob_name = '=ques=tion!'
blob_data = u'???'

# Act
blob = self.bsc.get_blob_client(self.container_name, blob_name)
await blob.upload_blob(blob_data)

# Assert
stream = await blob.download_blob()
data = await stream.readall()
self.assertIsNotNone(data)
content = data.decode('utf-8')
self.assertEqual(content, blob_data)

@GlobalStorageAccountPreparer()
@AsyncStorageTestCase.await_prepared_test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ def _get_canonicalized_resource(self, request):
uri_path = urlparse(request.http_request.url).path
try:
if isinstance(request.context.transport, AioHttpTransport) or \
isinstance(getattr(request.context.transport, "_transport", None), AioHttpTransport):
isinstance(getattr(request.context.transport, "_transport", None), AioHttpTransport) or \
isinstance(getattr(getattr(request.context.transport, "_transport", None), "_transport", None),
AioHttpTransport):
uri_path = URL(uri_path)
return '/' + self.account_name + str(uri_path)
except TypeError:
Expand Down
Loading