Skip to content

Commit ecdd736

Browse files
Clean async tests transport (#16973)
1 parent 47695ac commit ecdd736

File tree

1 file changed

+5
-19
lines changed

1 file changed

+5
-19
lines changed

sdk/storage/azure-storage-blob/tests/test_blob_client_async.py

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
ContainerClient,
1616
BlobClient,
1717
)
18-
from devtools_testutils import ResourceGroupPreparer, StorageAccountPreparer
19-
from azure.core.pipeline.transport import AioHttpTransport
20-
from multidict import CIMultiDict, CIMultiDictProxy
2118
from _shared.testcase import GlobalStorageAccountPreparer
2219
from devtools_testutils.storage.aio import AsyncStorageTestCase
2320

@@ -33,17 +30,6 @@
3330
_CONNECTION_ENDPOINTS_SECONDARY = {'blob': 'BlobSecondaryEndpoint'}
3431

3532

36-
class AiohttpTestTransport(AioHttpTransport):
37-
"""Workaround to vcrpy bug: https://github.com/kevin1024/vcrpy/pull/461
38-
"""
39-
async def send(self, request, **config):
40-
response = await super(AiohttpTestTransport, self).send(request, **config)
41-
if not isinstance(response.headers, CIMultiDictProxy):
42-
response.headers = CIMultiDictProxy(CIMultiDict(response.internal_response.headers))
43-
response.content_type = response.headers.get("content-type")
44-
return response
45-
46-
4733
class StorageClientTestAsync(AsyncStorageTestCase):
4834
def setUp(self):
4935
super(StorageClientTestAsync, self).setUp()
@@ -494,7 +480,7 @@ def test_create_blob_client_with_sub_directory_path_in_blob_name(self):
494480
@AsyncStorageTestCase.await_prepared_test
495481
async def test_request_callback_signed_header_async(self, resource_group, location, storage_account, storage_account_key):
496482
# Arrange
497-
service = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, transport=AiohttpTestTransport())
483+
service = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key)
498484
name = self.get_resource_name('cont')
499485

500486
# Act
@@ -514,7 +500,7 @@ def callback(request):
514500
@AsyncStorageTestCase.await_prepared_test
515501
async def test_response_callback_async(self, resource_group, location, storage_account, storage_account_key):
516502
# Arrange
517-
service = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, transport=AiohttpTestTransport())
503+
service = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key)
518504
name = self.get_resource_name('cont')
519505
container = service.get_container_client(name)
520506

@@ -530,7 +516,7 @@ def callback(response):
530516
@GlobalStorageAccountPreparer()
531517
@AsyncStorageTestCase.await_prepared_test
532518
async def test_user_agent_default_async(self, resource_group, location, storage_account, storage_account_key):
533-
service = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, transport=AiohttpTestTransport())
519+
service = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key)
534520

535521
def callback(response):
536522
self.assertTrue('User-Agent' in response.http_request.headers)
@@ -543,7 +529,7 @@ def callback(response):
543529
async def test_user_agent_custom_async(self, resource_group, location, storage_account, storage_account_key):
544530
custom_app = "TestApp/v1.0"
545531
service = BlobServiceClient(
546-
self.account_url(storage_account, "blob"), credential=storage_account_key, user_agent=custom_app, transport=AiohttpTestTransport())
532+
self.account_url(storage_account, "blob"), credential=storage_account_key, user_agent=custom_app)
547533

548534
def callback(response):
549535
self.assertTrue('User-Agent' in response.http_request.headers)
@@ -566,7 +552,7 @@ def callback(response):
566552
@GlobalStorageAccountPreparer()
567553
@AsyncStorageTestCase.await_prepared_test
568554
async def test_user_agent_append_async(self, resource_group, location, storage_account, storage_account_key):
569-
service = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, transport=AiohttpTestTransport())
555+
service = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key)
570556

571557
def callback(response):
572558
self.assertTrue('User-Agent' in response.http_request.headers)

0 commit comments

Comments
 (0)