15
15
ContainerClient ,
16
16
BlobClient ,
17
17
)
18
- from devtools_testutils import ResourceGroupPreparer , StorageAccountPreparer
19
- from azure .core .pipeline .transport import AioHttpTransport
20
- from multidict import CIMultiDict , CIMultiDictProxy
21
18
from _shared .testcase import GlobalStorageAccountPreparer
22
19
from devtools_testutils .storage .aio import AsyncStorageTestCase
23
20
33
30
_CONNECTION_ENDPOINTS_SECONDARY = {'blob' : 'BlobSecondaryEndpoint' }
34
31
35
32
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
-
47
33
class StorageClientTestAsync (AsyncStorageTestCase ):
48
34
def setUp (self ):
49
35
super (StorageClientTestAsync , self ).setUp ()
@@ -494,7 +480,7 @@ def test_create_blob_client_with_sub_directory_path_in_blob_name(self):
494
480
@AsyncStorageTestCase .await_prepared_test
495
481
async def test_request_callback_signed_header_async (self , resource_group , location , storage_account , storage_account_key ):
496
482
# 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 )
498
484
name = self .get_resource_name ('cont' )
499
485
500
486
# Act
@@ -514,7 +500,7 @@ def callback(request):
514
500
@AsyncStorageTestCase .await_prepared_test
515
501
async def test_response_callback_async (self , resource_group , location , storage_account , storage_account_key ):
516
502
# 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 )
518
504
name = self .get_resource_name ('cont' )
519
505
container = service .get_container_client (name )
520
506
@@ -530,7 +516,7 @@ def callback(response):
530
516
@GlobalStorageAccountPreparer ()
531
517
@AsyncStorageTestCase .await_prepared_test
532
518
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 )
534
520
535
521
def callback (response ):
536
522
self .assertTrue ('User-Agent' in response .http_request .headers )
@@ -543,7 +529,7 @@ def callback(response):
543
529
async def test_user_agent_custom_async (self , resource_group , location , storage_account , storage_account_key ):
544
530
custom_app = "TestApp/v1.0"
545
531
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 )
547
533
548
534
def callback (response ):
549
535
self .assertTrue ('User-Agent' in response .http_request .headers )
@@ -566,7 +552,7 @@ def callback(response):
566
552
@GlobalStorageAccountPreparer ()
567
553
@AsyncStorageTestCase .await_prepared_test
568
554
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 )
570
556
571
557
def callback (response ):
572
558
self .assertTrue ('User-Agent' in response .http_request .headers )
0 commit comments