From 6c3227c4395ba7a668b0cb151c4d10a5cabd5bf2 Mon Sep 17 00:00:00 2001 From: Laurent Mazuel Date: Thu, 23 Jan 2020 13:10:24 -0800 Subject: [PATCH] Improve StoragePreparer (#8930) * Support env variables and stuff * More tests * Accept storage account for account_url * Sync queue shared tests files * more changes * Feedback * Fix queue import * Fix playback mode * Updated blob test account URLs * Updated queue test account URLs * Secondary endpoints needs init too * Better support of connection string * Fixed missing awaits * Fix file share test pass * Strip / if endpoints are from ARM GET Co-authored-by: Rakshith Bhyravabhotla Co-authored-by: annatisch --- .../tests/_shared/asynctestcase.py | 3 + .../tests/_shared/testcase.py | 149 ++++++++-- .../tests/test_append_blob.py | 82 +++--- .../tests/test_append_blob_async.py | 82 +++--- .../tests/test_blob_access_conditions.py | 254 +++++++++--------- .../test_blob_access_conditions_async.py | 252 ++++++++--------- .../tests/test_blob_client.py | 36 +-- .../tests/test_blob_client_async.py | 40 +-- .../tests/test_blob_encryption.py | 68 ++--- .../tests/test_blob_encryption_async.py | 68 ++--- .../tests/test_blob_retry.py | 6 +- .../tests/test_blob_retry_async.py | 6 +- .../tests/test_blob_service_properties.py | 32 +-- .../test_blob_service_properties_async.py | 32 +-- .../tests/test_blob_service_stats.py | 4 +- .../tests/test_blob_service_stats_async.py | 4 +- .../tests/test_blob_storage_account.py | 6 +- .../tests/test_blob_storage_account_async.py | 6 +- .../tests/test_block_blob.py | 96 +++---- .../tests/test_block_blob_async.py | 96 ++++--- .../tests/test_block_blob_sync_copy.py | 10 +- .../tests/test_block_blob_sync_copy_async.py | 10 +- .../tests/test_common_blob.py | 210 +++++++-------- .../tests/test_common_blob_async.py | 198 +++++++------- .../tests/test_container.py | 130 ++++----- .../tests/test_container_async.py | 126 ++++----- .../azure-storage-blob/tests/test_cpk.py | 26 +- .../tests/test_cpk_async.py | 26 +- .../azure-storage-blob/tests/test_get_blob.py | 82 +++--- .../tests/test_get_blob_async.py | 78 +++--- .../tests/test_large_block_blob.py | 32 +-- .../tests/test_large_block_blob_async.py | 32 +-- .../azure-storage-blob/tests/test_logging.py | 6 +- .../tests/test_logging_async.py | 6 +- .../tests/test_page_blob.py | 126 ++++----- .../tests/test_page_blob_async.py | 128 ++++----- .../azure-storage-blob/tests/test_retry.py | 2 +- .../tests/test_retry_async.py | 2 +- .../tests/_shared/asynctestcase.py | 3 + .../tests/_shared/asynctestcase.py | 3 + .../tests/_shared/testcase.py | 149 ++++++++-- .../azure-storage-queue/tests/test_queue.py | 92 +++---- .../tests/test_queue_async.py | 94 +++---- .../tests/test_queue_client.py | 32 +-- .../tests/test_queue_client_async.py | 36 +-- .../tests/test_queue_encodings.py | 24 +- .../tests/test_queue_encodings_async.py | 24 +- .../tests/test_queue_encryption.py | 36 +-- .../tests/test_queue_encryption_async.py | 36 +-- .../tests/test_queue_service_properties.py | 14 +- .../test_queue_service_properties_async.py | 16 +- .../tests/test_queue_service_stats.py | 4 +- .../tests/test_queue_service_stats_async.py | 4 +- .../devtools_testutils/azure_testcase.py | 6 +- .../devtools_testutils/resource_testcase.py | 5 + .../devtools_testutils/storage_testcase.py | 27 +- 56 files changed, 1707 insertions(+), 1450 deletions(-) diff --git a/sdk/storage/azure-storage-blob/tests/_shared/asynctestcase.py b/sdk/storage/azure-storage-blob/tests/_shared/asynctestcase.py index a0b74f7c28fa..b00ffa6f3207 100644 --- a/sdk/storage/azure-storage-blob/tests/_shared/asynctestcase.py +++ b/sdk/storage/azure-storage-blob/tests/_shared/asynctestcase.py @@ -8,6 +8,8 @@ import asyncio import functools +from azure_devtools.scenario_tests.utilities import trim_kwargs_from_test_function + from azure.core.credentials import AccessToken from .testcase import StorageTestCase @@ -34,6 +36,7 @@ def await_prepared_test(test_fn): @functools.wraps(test_fn) def run(test_class_instance, *args, **kwargs): + trim_kwargs_from_test_function(test_fn, kwargs) loop = asyncio.get_event_loop() return loop.run_until_complete(test_fn(test_class_instance, **kwargs)) diff --git a/sdk/storage/azure-storage-blob/tests/_shared/testcase.py b/sdk/storage/azure-storage-blob/tests/_shared/testcase.py index 7d110e26f3b0..ad67794cfe34 100644 --- a/sdk/storage/azure-storage-blob/tests/_shared/testcase.py +++ b/sdk/storage/azure-storage-blob/tests/_shared/testcase.py @@ -25,7 +25,13 @@ import random import re import logging -from devtools_testutils import AzureMgmtTestCase, AzureMgmtPreparer, ResourceGroupPreparer, StorageAccountPreparer, FakeResource +from devtools_testutils import ( + AzureMgmtTestCase, + AzureMgmtPreparer, + ResourceGroupPreparer, + StorageAccountPreparer, + FakeResource, +) from azure_devtools.scenario_tests import RecordingProcessor, AzureTestError, create_random_name try: from cStringIO import StringIO # Python 2 @@ -34,6 +40,7 @@ from azure.core.credentials import AccessToken from azure.storage.blob import generate_account_sas, AccountSasPermissions, ResourceTypes +from azure.mgmt.storage.models import StorageAccount, Endpoints try: from devtools_testutils import mgmt_settings_real as settings @@ -87,16 +94,19 @@ def create_resource(self, name, **kwargs): "storagename" ) else: - storage_account = FakeResource( - id=storage_account.id, - name="storagename" - ) + name = "storagename" + storage_account.name = name + storage_account.primary_endpoints.blob = 'https://{}.{}.core.windows.net'.format(name, 'blob') + storage_account.primary_endpoints.queue = 'https://{}.{}.core.windows.net'.format(name, 'queue') + storage_account.primary_endpoints.table = 'https://{}.{}.core.windows.net'.format(name, 'table') + storage_account.primary_endpoints.file = 'https://{}.{}.core.windows.net'.format(name, 'file') return { 'location': 'westus', 'resource_group': StorageTestCase._RESOURCE_GROUP, 'storage_account': storage_account, 'storage_account_key': StorageTestCase._STORAGE_KEY, + 'storage_account_cs': StorageTestCase._STORAGE_CONNECTION_STRING, } class GlobalResourceGroupPreparer(AzureMgmtPreparer): @@ -134,13 +144,23 @@ def __init__(self, *args, **kwargs): def connection_string(self, account, key): return "DefaultEndpointsProtocol=https;AccountName=" + account.name + ";AccountKey=" + str(key) + ";EndpointSuffix=core.windows.net" - def account_url(self, name, storage_type): + def account_url(self, storage_account, storage_type): """Return an url of storage account. - :param str name: Storage account name + :param str storage_account: Storage account name :param str storage_type: The Storage type part of the URL. Should be "blob", or "queue", etc. """ - return 'https://{}.{}.core.windows.net'.format(name, storage_type) + try: + if storage_type == "blob": + return storage_account.primary_endpoints.blob.rstrip("/") + if storage_type == "queue": + return storage_account.primary_endpoints.queue.rstrip("/") + if storage_type == "file": + return storage_account.primary_endpoints.file.rstrip("/") + else: + raise ValueError("Unknown storage type {}".format(storage_type)) + except AttributeError: # Didn't find "primary_endpoints" + return 'https://{}.{}.core.windows.net'.format(storage_account, storage_type) def configure_logging(self): try: @@ -348,22 +368,109 @@ def storage_account(): storage_preparer = StorageAccountPreparer(random_name_enabled=True, name_prefix='pyacrstorage') # Create + subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", None) + location = os.environ.get("AZURE_LOCATION", "westus") + + existing_rg_name = os.environ.get("AZURE_RESOURCEGROUP_NAME") + existing_storage_name = os.environ.get("AZURE_STORAGE_ACCOUNT_NAME") + existing_storage_key = os.environ.get("AZURE_STORAGE_ACCOUNT_KEY") + storage_connection_string = os.environ.get("AZURE_STORAGE_CONNECTION_STRING") + + i_need_to_create_rg = not (existing_rg_name or existing_storage_name or storage_connection_string) + got_storage_info_from_env = existing_storage_name or storage_connection_string + try: - rg_name, rg_kwargs = rg_preparer._prepare_create_resource(test_case) - StorageTestCase._RESOURCE_GROUP = rg_kwargs['resource_group'] + if i_need_to_create_rg: + rg_name, rg_kwargs = rg_preparer._prepare_create_resource(test_case) + rg = rg_kwargs['resource_group'] + else: + rg_name = existing_rg_name or "no_rg_needed" + rg = FakeResource( + name=rg_name, + id="/subscriptions/{}/resourceGroups/{}".format(subscription_id, rg_name) + ) + StorageTestCase._RESOURCE_GROUP = rg + try: - storage_name, storage_kwargs = storage_preparer._prepare_create_resource(test_case, **rg_kwargs) - # Now the magic begins - StorageTestCase._STORAGE_ACCOUNT = storage_kwargs['storage_account'] - StorageTestCase._STORAGE_KEY = storage_kwargs['storage_account_key'] + if got_storage_info_from_env: + + if storage_connection_string: + storage_connection_string_parts = dict([ + part.split('=', 1) + for part in storage_connection_string.split(";") + ]) + + storage_account = None + if existing_storage_name: + storage_name = existing_storage_name + storage_account = StorageAccount( + location=location, + ) + storage_account.name = storage_name + storage_account.id = storage_name + storage_account.primary_endpoints=Endpoints() + storage_account.primary_endpoints.blob = 'https://{}.{}.core.windows.net'.format(storage_name, 'blob') + storage_account.primary_endpoints.queue = 'https://{}.{}.core.windows.net'.format(storage_name, 'queue') + storage_account.primary_endpoints.table = 'https://{}.{}.core.windows.net'.format(storage_name, 'table') + storage_account.primary_endpoints.file = 'https://{}.{}.core.windows.net'.format(storage_name, 'file') + storage_key = existing_storage_key + + if not storage_connection_string: + # It means I have received a storage name from env + storage_connection_string=";".join([ + "DefaultEndpointsProtocol=https", + "AccountName={}".format(storage_name), + "AccountKey={}".format(storage_key), + "BlobEndpoint={}".format(storage_account.primary_endpoints.blob), + "TableEndpoint={}".format(storage_account.primary_endpoints.table), + "QueueEndpoint={}".format(storage_account.primary_endpoints.queue), + "FileEndpoint={}".format(storage_account.primary_endpoints.file), + ]) + + if not storage_account: + # It means I have received a connection string + storage_name = storage_connection_string_parts["AccountName"] + storage_account = StorageAccount( + location=location, + ) + + def build_service_endpoint(service): + return "{}://{}.{}.{}".format( + storage_connection_string_parts.get("DefaultEndpointsProtocol", "https"), + storage_connection_string_parts["AccountName"], + service, + storage_connection_string_parts["EndpointSuffix"], # Let it fail if we don't even have that + ) + + storage_account.name = storage_name + storage_account.id = storage_name + storage_account.primary_endpoints=Endpoints() + storage_account.primary_endpoints.blob = storage_connection_string_parts.get("BlobEndpoint", build_service_endpoint("blob")) + storage_account.primary_endpoints.queue = storage_connection_string_parts.get("QueueEndpoint", build_service_endpoint("queue")) + storage_account.primary_endpoints.file = storage_connection_string_parts.get("FileEndpoint", build_service_endpoint("file")) + storage_account.secondary_endpoints=Endpoints() + storage_account.secondary_endpoints.blob = storage_connection_string_parts.get("BlobSecondaryEndpoint", build_service_endpoint("blob")) + storage_account.secondary_endpoints.queue = storage_connection_string_parts.get("QueueSecondaryEndpoint", build_service_endpoint("queue")) + storage_account.secondary_endpoints.file = storage_connection_string_parts.get("FileSecondaryEndpoint", build_service_endpoint("file")) + storage_key = storage_connection_string_parts["AccountKey"] + + else: + storage_name, storage_kwargs = storage_preparer._prepare_create_resource(test_case, **rg_kwargs) + storage_account = storage_kwargs['storage_account'] + storage_key = storage_kwargs['storage_account_key'] + storage_connection_string = storage_kwargs['storage_account_cs'] + + StorageTestCase._STORAGE_ACCOUNT = storage_account + StorageTestCase._STORAGE_KEY = storage_key + StorageTestCase._STORAGE_CONNECTION_STRING = storage_connection_string yield finally: - storage_preparer.remove_resource( - storage_name, - resource_group=rg_kwargs['resource_group'] - ) - StorageTestCase._STORAGE_ACCOUNT = None - StorageTestCase._STORAGE_KEY = None + if not got_storage_info_from_env: + storage_preparer.remove_resource( + storage_name, + resource_group=rg + ) finally: - rg_preparer.remove_resource(rg_name) + if i_need_to_create_rg: + rg_preparer.remove_resource(rg_name) StorageTestCase._RESOURCE_GROUP = None diff --git a/sdk/storage/azure-storage-blob/tests/test_append_blob.py b/sdk/storage/azure-storage-blob/tests/test_append_blob.py index 45df88a59e1d..e978856ce81a 100644 --- a/sdk/storage/azure-storage-blob/tests/test_append_blob.py +++ b/sdk/storage/azure-storage-blob/tests/test_append_blob.py @@ -89,7 +89,7 @@ def read(self, count): @GlobalStorageAccountPreparer() def test_create_blob(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) blob_name = self._get_blob_reference() @@ -105,7 +105,7 @@ def test_create_blob(self, resource_group, location, storage_account, storage_ac @GlobalStorageAccountPreparer() def test_create_blob_with_lease_id(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) @@ -121,7 +121,7 @@ def test_create_blob_with_lease_id(self, resource_group, location, storage_accou @GlobalStorageAccountPreparer() def test_create_blob_with_metadata(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) metadata = {'hello': 'world', 'number': '42'} blob_name = self._get_blob_reference() @@ -136,7 +136,7 @@ def test_create_blob_with_metadata(self, resource_group, location, storage_accou @GlobalStorageAccountPreparer() def test_append_block(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) @@ -153,7 +153,7 @@ def test_append_block(self, resource_group, location, storage_account, storage_a @GlobalStorageAccountPreparer() def test_append_block_unicode(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) @@ -168,7 +168,7 @@ def test_append_block_unicode(self, resource_group, location, storage_account, s @GlobalStorageAccountPreparer() def test_append_block_with_md5(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) @@ -184,7 +184,7 @@ def test_append_block_with_md5(self, resource_group, location, storage_account, @GlobalStorageAccountPreparer() def test_append_block_from_url(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) source_blob_client = self._create_source_blob(source_blob_data, bsc) @@ -232,7 +232,7 @@ def test_append_block_from_url(self, resource_group, location, storage_account, @GlobalStorageAccountPreparer() def test_append_block_from_url_and_validate_content_md5(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) source_blob_client = self._create_source_blob(source_blob_data, bsc) @@ -272,7 +272,7 @@ def test_append_block_from_url_and_validate_content_md5(self, resource_group, lo @GlobalStorageAccountPreparer() def test_append_block_from_url_with_source_if_modified(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) source_blob_client = self._create_source_blob(source_blob_data, bsc) @@ -317,7 +317,7 @@ def test_append_block_from_url_with_source_if_modified(self, resource_group, loc @GlobalStorageAccountPreparer() def test_append_block_from_url_with_source_if_unmodified(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) source_blob_client = self._create_source_blob(source_blob_data, bsc) @@ -362,7 +362,7 @@ def test_append_block_from_url_with_source_if_unmodified(self, resource_group, l @GlobalStorageAccountPreparer() def test_append_block_from_url_with_source_if_match(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) source_blob_client = self._create_source_blob(source_blob_data, bsc) @@ -407,7 +407,7 @@ def test_append_block_from_url_with_source_if_match(self, resource_group, locati @GlobalStorageAccountPreparer() def test_append_block_from_url_with_source_if_none_match(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) source_blob_client = self._create_source_blob(source_blob_data, bsc) @@ -452,7 +452,7 @@ def test_append_block_from_url_with_source_if_none_match(self, resource_group, l @GlobalStorageAccountPreparer() def test_append_block_from_url_with_if_match(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) source_blob_client = self._create_source_blob(source_blob_data, bsc) @@ -500,7 +500,7 @@ def test_append_block_from_url_with_if_match(self, resource_group, location, sto @GlobalStorageAccountPreparer() def test_append_block_from_url_with_if_none_match(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) source_blob_client = self._create_source_blob(source_blob_data, bsc) @@ -543,7 +543,7 @@ def test_append_block_from_url_with_if_none_match(self, resource_group, location @GlobalStorageAccountPreparer() def test_append_block_from_url_with_maxsize_condition(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) source_blob_client = self._create_source_blob(source_blob_data, bsc) @@ -585,7 +585,7 @@ def test_append_block_from_url_with_maxsize_condition(self, resource_group, loca @GlobalStorageAccountPreparer() def test_append_block_from_url_with_appendpos_condition(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) source_blob_client = self._create_source_blob(source_blob_data, bsc) @@ -627,7 +627,7 @@ def test_append_block_from_url_with_appendpos_condition(self, resource_group, lo @GlobalStorageAccountPreparer() def test_append_block_from_url_with_if_modified(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) source_blob_client = self._create_source_blob(source_blob_data, bsc) @@ -671,7 +671,7 @@ def test_append_block_from_url_with_if_modified(self, resource_group, location, @GlobalStorageAccountPreparer() def test_append_block_from_url_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) source_blob_client = self._create_source_blob(source_blob_data, bsc) @@ -714,7 +714,7 @@ def test_append_block_from_url_with_if_unmodified(self, resource_group, location @GlobalStorageAccountPreparer() def test_create_append_blob_with_no_overwrite(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) blob_name = self._get_blob_reference() blob = bsc.get_blob_client( @@ -749,7 +749,7 @@ def test_create_append_blob_with_no_overwrite(self, resource_group, location, st @GlobalStorageAccountPreparer() def test_create_append_blob_with_overwrite(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) blob_name = self._get_blob_reference() blob = bsc.get_blob_client( @@ -782,7 +782,7 @@ def test_create_append_blob_with_overwrite(self, resource_group, location, stora @GlobalStorageAccountPreparer() def test_append_blob_from_bytes(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) @@ -798,7 +798,7 @@ def test_append_blob_from_bytes(self, resource_group, location, storage_account, @GlobalStorageAccountPreparer() def test_append_blob_from_0_bytes(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) @@ -814,7 +814,7 @@ def test_append_blob_from_0_bytes(self, resource_group, location, storage_accoun @GlobalStorageAccountPreparer() def test_append_blob_from_bytes_with_progress(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) data = b'abcdefghijklmnopqrstuvwxyz' @@ -835,7 +835,7 @@ def progress_gen(upload): @GlobalStorageAccountPreparer() def test_append_blob_from_bytes_with_index(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) @@ -849,7 +849,7 @@ def test_append_blob_from_bytes_with_index(self, resource_group, location, stora @GlobalStorageAccountPreparer() def test_append_blob_from_bytes_with_index_and_count(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) @@ -863,7 +863,7 @@ def test_append_blob_from_bytes_with_index_and_count(self, resource_group, locat @GlobalStorageAccountPreparer() def test_append_blob_from_bytes_chunked_upload(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -880,7 +880,7 @@ def test_append_blob_from_bytes_chunked_upload(self, resource_group, location, s @GlobalStorageAccountPreparer() def test_append_blob_from_bytes_with_progress_chunked_upload(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -908,7 +908,7 @@ def progress_gen(upload): @GlobalStorageAccountPreparer() def test_append_blob_from_bytes_chunked_upload_with_index_and_count(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -923,7 +923,7 @@ def test_append_blob_from_bytes_chunked_upload_with_index_and_count(self, resour @GlobalStorageAccountPreparer() def test_append_blob_from_path_chunked_upload(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -946,7 +946,7 @@ def test_append_blob_from_path_chunked_upload(self, resource_group, location, st @GlobalStorageAccountPreparer() def test_append_blob_from_path_with_progress_chunked_upload(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -981,7 +981,7 @@ def progress_gen(upload): @GlobalStorageAccountPreparer() def test_append_blob_from_stream_chunked_upload(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1003,7 +1003,7 @@ def test_append_blob_from_stream_chunked_upload(self, resource_group, location, @GlobalStorageAccountPreparer() def test_app_blob_from_stream_nonseekable_chnked_upload_known_size(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1024,7 +1024,7 @@ def test_app_blob_from_stream_nonseekable_chnked_upload_known_size(self, resourc @GlobalStorageAccountPreparer() def test_app_blob_from_stream_nonseekable_chnked_upload_unk_size(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1044,7 +1044,7 @@ def test_app_blob_from_stream_nonseekable_chnked_upload_unk_size(self, resource_ @GlobalStorageAccountPreparer() def test_append_blob_from_stream_with_multiple_appends(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1068,7 +1068,7 @@ def test_append_blob_from_stream_with_multiple_appends(self, resource_group, loc @GlobalStorageAccountPreparer() def test_append_blob_from_stream_chunked_upload_with_count(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1090,7 +1090,7 @@ def test_append_blob_from_stream_chunked_upload_with_count(self, resource_group, def test_append_blob_from_stream_chunked_upload_with_count_parallel(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1112,7 +1112,7 @@ def test_append_blob_from_stream_chunked_upload_with_count_parallel(self, resour @GlobalStorageAccountPreparer() def test_append_blob_from_text(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) text = u'hello 啊齄丂狛狜 world' @@ -1129,7 +1129,7 @@ def test_append_blob_from_text(self, resource_group, location, storage_account, @GlobalStorageAccountPreparer() def test_append_blob_from_text_with_encoding(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) text = u'hello 啊齄丂狛狜 world' @@ -1144,7 +1144,7 @@ def test_append_blob_from_text_with_encoding(self, resource_group, location, sto @GlobalStorageAccountPreparer() def test_append_blob_from_text_with_encoding_and_progress(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) text = u'hello 啊齄丂狛狜 world' @@ -1165,7 +1165,7 @@ def progress_gen(upload): @GlobalStorageAccountPreparer() def test_append_blob_from_text_chunked_upload(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_text_data(LARGE_BLOB_SIZE) @@ -1179,7 +1179,7 @@ def test_append_blob_from_text_chunked_upload(self, resource_group, location, st @GlobalStorageAccountPreparer() def test_append_blob_with_md5(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) data = b'hello world' diff --git a/sdk/storage/azure-storage-blob/tests/test_append_blob_async.py b/sdk/storage/azure-storage-blob/tests/test_append_blob_async.py index 46b0b7a5d717..45adee8a2f25 100644 --- a/sdk/storage/azure-storage-blob/tests/test_append_blob_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_append_blob_async.py @@ -112,7 +112,7 @@ def read(self, count): @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_create_blob_async(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob_name = self._get_blob_reference() @@ -131,7 +131,7 @@ async def test_create_blob_async(self, resource_group, location, storage_account @AsyncStorageTestCase.await_prepared_test async def test_create_blob_with_lease_id_async(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -150,7 +150,7 @@ async def test_create_blob_with_lease_id_async(self, resource_group, location, s @AsyncStorageTestCase.await_prepared_test async def test_create_blob_with_metadata_async(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) metadata = {'hello': 'world', 'number': '42'} @@ -167,7 +167,7 @@ async def test_create_blob_with_metadata_async(self, resource_group, location, s @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_append_block_async(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -186,7 +186,7 @@ async def test_append_block_async(self, resource_group, location, storage_accoun @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_append_block_unicode_async(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -203,7 +203,7 @@ async def test_append_block_unicode_async(self, resource_group, location, storag @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_append_block_with_md5_async(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -221,7 +221,7 @@ async def test_append_block_with_md5_async(self, resource_group, location, stora @AsyncStorageTestCase.await_prepared_test async def test_append_block_from_url_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -271,7 +271,7 @@ async def test_append_block_from_url_async(self, resource_group, location, stora @AsyncStorageTestCase.await_prepared_test async def test_append_block_from_url_and_validate_content_md5_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -313,7 +313,7 @@ async def test_append_block_from_url_and_validate_content_md5_async(self, resour @AsyncStorageTestCase.await_prepared_test async def test_append_block_from_url_with_source_if_modified_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -360,7 +360,7 @@ async def test_append_block_from_url_with_source_if_modified_async(self, resourc @AsyncStorageTestCase.await_prepared_test async def test_append_block_from_url_with_source_if_unmodified_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -408,7 +408,7 @@ async def test_append_block_from_url_with_source_if_unmodified_async(self, resou @AsyncStorageTestCase.await_prepared_test async def test_append_block_from_url_with_source_if_match_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -455,7 +455,7 @@ async def test_append_block_from_url_with_source_if_match_async(self, resource_g @AsyncStorageTestCase.await_prepared_test async def test_append_block_from_url_with_source_if_none_match_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -502,7 +502,7 @@ async def test_append_block_from_url_with_source_if_none_match_async(self, resou @AsyncStorageTestCase.await_prepared_test async def test_append_block_from_url_with_if_match_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -552,7 +552,7 @@ async def test_append_block_from_url_with_if_match_async(self, resource_group, l @AsyncStorageTestCase.await_prepared_test async def test_append_block_from_url_with_if_none_match_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -598,7 +598,7 @@ async def test_append_block_from_url_with_if_none_match_async(self, resource_gro @AsyncStorageTestCase.await_prepared_test async def test_append_block_from_url_with_maxsize_condition_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -643,7 +643,7 @@ async def test_append_block_from_url_with_maxsize_condition_async(self, resource @AsyncStorageTestCase.await_prepared_test async def test_append_block_from_url_with_appendpos_condition_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -688,7 +688,7 @@ async def test_append_block_from_url_with_appendpos_condition_async(self, resour @AsyncStorageTestCase.await_prepared_test async def test_append_block_from_url_with_if_modified_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -735,7 +735,7 @@ async def test_append_block_from_url_with_if_modified_async(self, resource_group @AsyncStorageTestCase.await_prepared_test async def test_append_block_from_url_with_if_unmodified_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -782,7 +782,7 @@ async def test_append_block_from_url_with_if_unmodified_async(self, resource_gro @AsyncStorageTestCase.await_prepared_test async def test_create_append_blob_with_no_overwrite_async(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob_name = self._get_blob_reference() @@ -820,7 +820,7 @@ async def test_create_append_blob_with_no_overwrite_async(self, resource_group, @AsyncStorageTestCase.await_prepared_test async def test_create_append_blob_with_overwrite_async(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob_name = self._get_blob_reference() @@ -855,7 +855,7 @@ async def test_create_append_blob_with_overwrite_async(self, resource_group, loc @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_append_blob_from_bytes_async(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -873,7 +873,7 @@ async def test_append_blob_from_bytes_async(self, resource_group, location, stor @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_append_blob_from_0_bytes_async(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -892,7 +892,7 @@ async def test_append_blob_from_0_bytes_async(self, resource_group, location, st @AsyncStorageTestCase.await_prepared_test async def test_append_blob_from_bytes_with_progress_async(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -916,7 +916,7 @@ def progress_gen(upload): @AsyncStorageTestCase.await_prepared_test async def test_append_blob_from_bytes_with_index_async(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -932,7 +932,7 @@ async def test_append_blob_from_bytes_with_index_async(self, resource_group, loc @AsyncStorageTestCase.await_prepared_test async def test_append_blob_from_bytes_with_index_and_count_async(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -948,7 +948,7 @@ async def test_append_blob_from_bytes_with_index_and_count_async(self, resource_ @AsyncStorageTestCase.await_prepared_test async def test_append_blob_from_bytes_chunked_upload_async(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -967,7 +967,7 @@ async def test_append_blob_from_bytes_chunked_upload_async(self, resource_group, @AsyncStorageTestCase.await_prepared_test async def test_app_blob_from_bytes_progress_chnked_upload_async(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -998,7 +998,7 @@ def progress_gen(upload): async def test_appblob_frm_bytes_chnked_upload_w_idx_n_count_async(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -1016,7 +1016,7 @@ async def test_appblob_frm_bytes_chnked_upload_w_idx_n_count_async(self, resourc @AsyncStorageTestCase.await_prepared_test async def test_append_blob_from_path_chunked_upload_async(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -1041,7 +1041,7 @@ async def test_append_blob_from_path_chunked_upload_async(self, resource_group, @AsyncStorageTestCase.await_prepared_test async def test_append_blob_from_path_with_progress_chunked_upload_async(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -1078,7 +1078,7 @@ def progress_gen(upload): @AsyncStorageTestCase.await_prepared_test async def test_append_blob_from_stream_chunked_upload_async(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -1103,7 +1103,7 @@ async def test_append_blob_from_stream_chunked_upload_async(self, resource_group async def test_append_blob_from_stream_non_seekable_chunked_upload_known_size_async(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -1127,7 +1127,7 @@ async def test_append_blob_from_stream_non_seekable_chunked_upload_known_size_as async def test_append_blob_from_stream_non_seekable_chunked_upload_unknown_size_async(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -1149,7 +1149,7 @@ async def test_append_blob_from_stream_non_seekable_chunked_upload_unknown_size_ @AsyncStorageTestCase.await_prepared_test async def test_append_blob_from_stream_with_multiple_appends_async(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -1175,7 +1175,7 @@ async def test_append_blob_from_stream_with_multiple_appends_async(self, resourc @AsyncStorageTestCase.await_prepared_test async def test_append_blob_from_stream_chunked_upload_with_count_async(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -1200,7 +1200,7 @@ async def test_append_blob_from_stream_chunked_upload_with_count_parallel_async( storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -1224,7 +1224,7 @@ async def test_append_blob_from_stream_chunked_upload_with_count_parallel_async( @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_append_blob_from_text_async(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -1244,7 +1244,7 @@ async def test_append_blob_from_text_async(self, resource_group, location, stora @AsyncStorageTestCase.await_prepared_test async def test_append_blob_from_text_with_encoding_async(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -1261,7 +1261,7 @@ async def test_append_blob_from_text_with_encoding_async(self, resource_group, l @AsyncStorageTestCase.await_prepared_test async def test_append_blob_from_text_with_encoding_and_progress_async(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -1285,7 +1285,7 @@ def progress_gen(upload): @AsyncStorageTestCase.await_prepared_test async def test_append_blob_from_text_chunked_upload_async(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -1301,7 +1301,7 @@ async def test_append_blob_from_text_chunked_upload_async(self, resource_group, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_append_blob_with_md5_async(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, max_block_size=4 * 1024, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, max_block_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions.py b/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions.py index 40a0cc6701c4..7fed3d6da5fe 100644 --- a/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions.py +++ b/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions.py @@ -69,7 +69,7 @@ def _create_container_and_append_blob(self, container_name, blob_name, bsc): # --Test cases for blob service -------------------------------------------- @GlobalStorageAccountPreparer() def test_set_container_metadata_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container = self._create_container(self.container_name, bsc) test_datetime = (datetime.utcnow() - @@ -85,7 +85,7 @@ def test_set_container_metadata_with_if_modified(self, resource_group, location, @GlobalStorageAccountPreparer() def test_set_container_metadata_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container = self._create_container(self.container_name, bsc) test_datetime = (datetime.utcnow() + @@ -101,7 +101,7 @@ def test_set_container_metadata_with_if_modified_fail(self, resource_group, loca @GlobalStorageAccountPreparer() def test_set_container_acl_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container = self._create_container(self.container_name, bsc) test_datetime = (datetime.utcnow() - @@ -119,7 +119,7 @@ def test_set_container_acl_with_if_modified(self, resource_group, location, stor @GlobalStorageAccountPreparer() def test_set_container_acl_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container = self._create_container(self.container_name, bsc) test_datetime = (datetime.utcnow() + @@ -137,7 +137,7 @@ def test_set_container_acl_with_if_modified_fail(self, resource_group, location, @GlobalStorageAccountPreparer() def test_set_container_acl_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container = self._create_container(self.container_name, bsc) test_datetime = (datetime.utcnow() + @@ -155,7 +155,7 @@ def test_set_container_acl_with_if_unmodified(self, resource_group, location, st @GlobalStorageAccountPreparer() def test_set_container_acl_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container = self._create_container(self.container_name, bsc) test_datetime = (datetime.utcnow() - @@ -173,7 +173,7 @@ def test_set_container_acl_with_if_unmodified_fail(self, resource_group, locatio @GlobalStorageAccountPreparer() def test_lease_container_acquire_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container = self._create_container(self.container_name, bsc) test_datetime = (datetime.utcnow() - @@ -187,7 +187,7 @@ def test_lease_container_acquire_with_if_modified(self, resource_group, location @GlobalStorageAccountPreparer() def test_lease_container_acquire_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container = self._create_container(self.container_name, bsc) test_datetime = (datetime.utcnow() + @@ -202,7 +202,7 @@ def test_lease_container_acquire_with_if_modified_fail(self, resource_group, loc @GlobalStorageAccountPreparer() def test_lease_container_acquire_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container = self._create_container(self.container_name, bsc) test_datetime = (datetime.utcnow() + @@ -216,7 +216,7 @@ def test_lease_container_acquire_with_if_unmodified(self, resource_group, locati @GlobalStorageAccountPreparer() def test_lease_container_acquire_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container = self._create_container(self.container_name, bsc) test_datetime = (datetime.utcnow() - @@ -231,7 +231,7 @@ def test_lease_container_acquire_with_if_unmodified_fail(self, resource_group, l @GlobalStorageAccountPreparer() def test_delete_container_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container = self._create_container(self.container_name, bsc) test_datetime = (datetime.utcnow() - @@ -246,7 +246,7 @@ def test_delete_container_with_if_modified(self, resource_group, location, stora @GlobalStorageAccountPreparer() def test_delete_container_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container = self._create_container(self.container_name, bsc) test_datetime = (datetime.utcnow() + @@ -260,7 +260,7 @@ def test_delete_container_with_if_modified_fail(self, resource_group, location, @GlobalStorageAccountPreparer() def test_delete_container_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container = self._create_container(self.container_name, bsc) test_datetime = (datetime.utcnow() + @@ -274,7 +274,7 @@ def test_delete_container_with_if_unmodified(self, resource_group, location, sto @GlobalStorageAccountPreparer() def test_delete_container_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container = self._create_container(self.container_name, bsc) test_datetime = (datetime.utcnow() - @@ -287,7 +287,7 @@ def test_delete_container_with_if_unmodified_fail(self, resource_group, location @GlobalStorageAccountPreparer() def test_put_blob_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() data = b'hello world' container, blob = self._create_container_and_block_blob( @@ -303,7 +303,7 @@ def test_put_blob_with_if_modified(self, resource_group, location, storage_accou @GlobalStorageAccountPreparer() def test_put_blob_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() data = b'hello world' container, blob = self._create_container_and_block_blob( @@ -320,7 +320,7 @@ def test_put_blob_with_if_modified_fail(self, resource_group, location, storage_ @GlobalStorageAccountPreparer() def test_put_blob_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() data = b'hello world' container, blob = self._create_container_and_block_blob( @@ -336,7 +336,7 @@ def test_put_blob_with_if_unmodified(self, resource_group, location, storage_acc @GlobalStorageAccountPreparer() def test_put_blob_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() data = b'hello world' container, blob = self._create_container_and_block_blob( @@ -353,7 +353,7 @@ def test_put_blob_with_if_unmodified_fail(self, resource_group, location, storag @GlobalStorageAccountPreparer() def test_put_blob_with_if_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() data = b'hello world' container, blob = self._create_container_and_block_blob( @@ -373,7 +373,7 @@ def test_put_blob_with_if_match(self, resource_group, location, storage_account, @GlobalStorageAccountPreparer() def test_put_blob_with_if_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() data = b'hello world' container, blob = self._create_container_and_block_blob( @@ -393,7 +393,7 @@ def test_put_blob_with_if_match_fail(self, resource_group, location, storage_acc @GlobalStorageAccountPreparer() def test_put_blob_with_if_none_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() data = b'hello world' container, blob = self._create_container_and_block_blob( @@ -411,7 +411,7 @@ def test_put_blob_with_if_none_match(self, resource_group, location, storage_acc @GlobalStorageAccountPreparer() def test_put_blob_with_if_none_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() data = b'hello world' container, blob = self._create_container_and_block_blob( @@ -427,7 +427,7 @@ def test_put_blob_with_if_none_match_fail(self, resource_group, location, storag @GlobalStorageAccountPreparer() def test_get_blob_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -442,7 +442,7 @@ def test_get_blob_with_if_modified(self, resource_group, location, storage_accou @GlobalStorageAccountPreparer() def test_get_blob_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -458,7 +458,7 @@ def test_get_blob_with_if_modified_fail(self, resource_group, location, storage_ @GlobalStorageAccountPreparer() def test_get_blob_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -473,7 +473,7 @@ def test_get_blob_with_if_unmodified(self, resource_group, location, storage_acc @GlobalStorageAccountPreparer() def test_get_blob_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -489,7 +489,7 @@ def test_get_blob_with_if_unmodified_fail(self, resource_group, location, storag @GlobalStorageAccountPreparer() def test_get_blob_with_if_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -503,7 +503,7 @@ def test_get_blob_with_if_match(self, resource_group, location, storage_account, @GlobalStorageAccountPreparer() def test_get_blob_with_if_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -517,7 +517,7 @@ def test_get_blob_with_if_match_fail(self, resource_group, location, storage_acc @GlobalStorageAccountPreparer() def test_get_blob_with_if_none_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -530,7 +530,7 @@ def test_get_blob_with_if_none_match(self, resource_group, location, storage_acc @GlobalStorageAccountPreparer() def test_get_blob_with_if_none_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -545,7 +545,7 @@ def test_get_blob_with_if_none_match_fail(self, resource_group, location, storag @GlobalStorageAccountPreparer() def test_set_blob_properties_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -565,7 +565,7 @@ def test_set_blob_properties_with_if_modified(self, resource_group, location, st @GlobalStorageAccountPreparer() def test_set_blob_properties_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -584,7 +584,7 @@ def test_set_blob_properties_with_if_modified_fail(self, resource_group, locatio @GlobalStorageAccountPreparer() def test_set_blob_properties_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -604,7 +604,7 @@ def test_set_blob_properties_with_if_unmodified(self, resource_group, location, @GlobalStorageAccountPreparer() def test_set_blob_properties_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -623,7 +623,7 @@ def test_set_blob_properties_with_if_unmodified_fail(self, resource_group, locat @GlobalStorageAccountPreparer() def test_set_blob_properties_with_if_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -643,7 +643,7 @@ def test_set_blob_properties_with_if_match(self, resource_group, location, stora @GlobalStorageAccountPreparer() def test_set_blob_properties_with_if_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -661,7 +661,7 @@ def test_set_blob_properties_with_if_match_fail(self, resource_group, location, @GlobalStorageAccountPreparer() def test_set_blob_properties_with_if_none_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -680,7 +680,7 @@ def test_set_blob_properties_with_if_none_match(self, resource_group, location, @GlobalStorageAccountPreparer() def test_set_blob_properties_with_if_none_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -699,7 +699,7 @@ def test_set_blob_properties_with_if_none_match_fail(self, resource_group, locat @GlobalStorageAccountPreparer() def test_get_blob_properties_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -717,7 +717,7 @@ def test_get_blob_properties_with_if_modified(self, resource_group, location, st @GlobalStorageAccountPreparer() def test_get_blob_properties_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -733,7 +733,7 @@ def test_get_blob_properties_with_if_modified_fail(self, resource_group, locatio @GlobalStorageAccountPreparer() def test_get_blob_properties_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -751,7 +751,7 @@ def test_get_blob_properties_with_if_unmodified(self, resource_group, location, @GlobalStorageAccountPreparer() def test_get_blob_properties_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -767,7 +767,7 @@ def test_get_blob_properties_with_if_unmodified_fail(self, resource_group, locat @GlobalStorageAccountPreparer() def test_get_blob_properties_with_if_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -785,7 +785,7 @@ def test_get_blob_properties_with_if_match(self, resource_group, location, stora @GlobalStorageAccountPreparer() def test_get_blob_properties_with_if_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -800,7 +800,7 @@ def test_get_blob_properties_with_if_match_fail(self, resource_group, location, @GlobalStorageAccountPreparer() def test_get_blob_properties_with_if_none_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -817,7 +817,7 @@ def test_get_blob_properties_with_if_none_match(self, resource_group, location, @GlobalStorageAccountPreparer() def test_get_blob_properties_with_if_none_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -833,7 +833,7 @@ def test_get_blob_properties_with_if_none_match_fail(self, resource_group, locat @GlobalStorageAccountPreparer() def test_get_blob_metadata_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -849,7 +849,7 @@ def test_get_blob_metadata_with_if_modified(self, resource_group, location, stor @GlobalStorageAccountPreparer() def test_get_blob_metadata_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -866,7 +866,7 @@ def test_get_blob_metadata_with_if_modified_fail(self, resource_group, location, @GlobalStorageAccountPreparer() def test_get_blob_metadata_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -882,7 +882,7 @@ def test_get_blob_metadata_with_if_unmodified(self, resource_group, location, st @GlobalStorageAccountPreparer() def test_get_blob_metadata_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -899,7 +899,7 @@ def test_get_blob_metadata_with_if_unmodified_fail(self, resource_group, locatio @GlobalStorageAccountPreparer() def test_get_blob_metadata_with_if_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -914,7 +914,7 @@ def test_get_blob_metadata_with_if_match(self, resource_group, location, storage @GlobalStorageAccountPreparer() def test_get_blob_metadata_with_if_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -929,7 +929,7 @@ def test_get_blob_metadata_with_if_match_fail(self, resource_group, location, st @GlobalStorageAccountPreparer() def test_get_blob_metadata_with_if_none_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -943,7 +943,7 @@ def test_get_blob_metadata_with_if_none_match(self, resource_group, location, st @GlobalStorageAccountPreparer() def test_get_blob_metadata_with_if_none_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -959,7 +959,7 @@ def test_get_blob_metadata_with_if_none_match_fail(self, resource_group, locatio @GlobalStorageAccountPreparer() def test_set_blob_metadata_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -977,7 +977,7 @@ def test_set_blob_metadata_with_if_modified(self, resource_group, location, stor @GlobalStorageAccountPreparer() def test_set_blob_metadata_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -995,7 +995,7 @@ def test_set_blob_metadata_with_if_modified_fail(self, resource_group, location, @GlobalStorageAccountPreparer() def test_set_blob_metadata_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1013,7 +1013,7 @@ def test_set_blob_metadata_with_if_unmodified(self, resource_group, location, st @GlobalStorageAccountPreparer() def test_set_blob_metadata_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1031,7 +1031,7 @@ def test_set_blob_metadata_with_if_unmodified_fail(self, resource_group, locatio @GlobalStorageAccountPreparer() def test_set_blob_metadata_with_if_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1048,7 +1048,7 @@ def test_set_blob_metadata_with_if_match(self, resource_group, location, storage @GlobalStorageAccountPreparer() def test_set_blob_metadata_with_if_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1064,7 +1064,7 @@ def test_set_blob_metadata_with_if_match_fail(self, resource_group, location, st @GlobalStorageAccountPreparer() def test_set_blob_metadata_with_if_none_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1080,7 +1080,7 @@ def test_set_blob_metadata_with_if_none_match(self, resource_group, location, st @GlobalStorageAccountPreparer() def test_set_blob_metadata_with_if_none_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1097,7 +1097,7 @@ def test_set_blob_metadata_with_if_none_match_fail(self, resource_group, locatio @GlobalStorageAccountPreparer() def test_delete_blob_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() test_datetime = (datetime.utcnow() - timedelta(minutes=15)) @@ -1113,7 +1113,7 @@ def test_delete_blob_with_if_modified(self, resource_group, location, storage_ac @GlobalStorageAccountPreparer() def test_delete_blob_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() test_datetime = (datetime.utcnow() + timedelta(minutes=15)) @@ -1130,7 +1130,7 @@ def test_delete_blob_with_if_modified_fail(self, resource_group, location, stora @GlobalStorageAccountPreparer() def test_delete_blob_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() test_datetime = (datetime.utcnow() + timedelta(minutes=15)) @@ -1146,7 +1146,7 @@ def test_delete_blob_with_if_unmodified(self, resource_group, location, storage_ @GlobalStorageAccountPreparer() def test_delete_blob_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() test_datetime = (datetime.utcnow() - timedelta(minutes=15)) @@ -1163,7 +1163,7 @@ def test_delete_blob_with_if_unmodified_fail(self, resource_group, location, sto @GlobalStorageAccountPreparer() def test_delete_blob_with_if_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1179,7 +1179,7 @@ def test_delete_blob_with_if_match(self, resource_group, location, storage_accou @GlobalStorageAccountPreparer() def test_delete_blob_with_if_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1194,7 +1194,7 @@ def test_delete_blob_with_if_match_fail(self, resource_group, location, storage_ @GlobalStorageAccountPreparer() def test_delete_blob_with_if_none_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1208,7 +1208,7 @@ def test_delete_blob_with_if_none_match(self, resource_group, location, storage_ @GlobalStorageAccountPreparer() def test_delete_blob_with_if_none_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1224,7 +1224,7 @@ def test_delete_blob_with_if_none_match_fail(self, resource_group, location, sto @GlobalStorageAccountPreparer() def test_snapshot_blob_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1241,7 +1241,7 @@ def test_snapshot_blob_with_if_modified(self, resource_group, location, storage_ @GlobalStorageAccountPreparer() def test_snapshot_blob_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1258,7 +1258,7 @@ def test_snapshot_blob_with_if_modified_fail(self, resource_group, location, sto @GlobalStorageAccountPreparer() def test_snapshot_blob_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1275,7 +1275,7 @@ def test_snapshot_blob_with_if_unmodified(self, resource_group, location, storag @GlobalStorageAccountPreparer() def test_snapshot_blob_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1292,7 +1292,7 @@ def test_snapshot_blob_with_if_unmodified_fail(self, resource_group, location, s @GlobalStorageAccountPreparer() def test_snapshot_blob_with_if_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1308,7 +1308,7 @@ def test_snapshot_blob_with_if_match(self, resource_group, location, storage_acc @GlobalStorageAccountPreparer() def test_snapshot_blob_with_if_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1323,7 +1323,7 @@ def test_snapshot_blob_with_if_match_fail(self, resource_group, location, storag @GlobalStorageAccountPreparer() def test_snapshot_blob_with_if_none_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1338,7 +1338,7 @@ def test_snapshot_blob_with_if_none_match(self, resource_group, location, storag @GlobalStorageAccountPreparer() def test_snapshot_blob_with_if_none_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1354,7 +1354,7 @@ def test_snapshot_blob_with_if_none_match_fail(self, resource_group, location, s @GlobalStorageAccountPreparer() def test_lease_blob_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1376,7 +1376,7 @@ def test_lease_blob_with_if_modified(self, resource_group, location, storage_acc @GlobalStorageAccountPreparer() def test_lease_blob_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1393,7 +1393,7 @@ def test_lease_blob_with_if_modified_fail(self, resource_group, location, storag @GlobalStorageAccountPreparer() def test_lease_blob_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1415,7 +1415,7 @@ def test_lease_blob_with_if_unmodified(self, resource_group, location, storage_a @GlobalStorageAccountPreparer() def test_lease_blob_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1432,7 +1432,7 @@ def test_lease_blob_with_if_unmodified_fail(self, resource_group, location, stor @GlobalStorageAccountPreparer() def test_lease_blob_with_if_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1453,7 +1453,7 @@ def test_lease_blob_with_if_match(self, resource_group, location, storage_accoun @GlobalStorageAccountPreparer() def test_lease_blob_with_if_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1468,7 +1468,7 @@ def test_lease_blob_with_if_match_fail(self, resource_group, location, storage_a @GlobalStorageAccountPreparer() def test_lease_blob_with_if_none_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1489,7 +1489,7 @@ def test_lease_blob_with_if_none_match(self, resource_group, location, storage_a @GlobalStorageAccountPreparer() def test_lease_blob_with_if_none_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1505,7 +1505,7 @@ def test_lease_blob_with_if_none_match_fail(self, resource_group, location, stor @GlobalStorageAccountPreparer() def test_put_block_list_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -1525,7 +1525,7 @@ def test_put_block_list_with_if_modified(self, resource_group, location, storage @GlobalStorageAccountPreparer() def test_put_block_list_with_metadata(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -1548,7 +1548,7 @@ def test_put_block_list_with_metadata(self, resource_group, location, storage_ac @GlobalStorageAccountPreparer() def test_put_block_list_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -1569,7 +1569,7 @@ def test_put_block_list_with_if_modified_fail(self, resource_group, location, st @GlobalStorageAccountPreparer() def test_put_block_list_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -1589,7 +1589,7 @@ def test_put_block_list_with_if_unmodified(self, resource_group, location, stora @GlobalStorageAccountPreparer() def test_put_block_list_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -1610,7 +1610,7 @@ def test_put_block_list_with_if_unmodified_fail(self, resource_group, location, @GlobalStorageAccountPreparer() def test_put_block_list_with_if_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -1629,7 +1629,7 @@ def test_put_block_list_with_if_match(self, resource_group, location, storage_ac @GlobalStorageAccountPreparer() def test_put_block_list_with_if_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -1648,7 +1648,7 @@ def test_put_block_list_with_if_match_fail(self, resource_group, location, stora @GlobalStorageAccountPreparer() def test_put_block_list_with_if_none_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -1666,7 +1666,7 @@ def test_put_block_list_with_if_none_match(self, resource_group, location, stora @GlobalStorageAccountPreparer() def test_put_block_list_with_if_none_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -1685,7 +1685,7 @@ def test_put_block_list_with_if_none_match_fail(self, resource_group, location, @GlobalStorageAccountPreparer() def test_update_page_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -1701,7 +1701,7 @@ def test_update_page_with_if_modified(self, resource_group, location, storage_ac @GlobalStorageAccountPreparer() def test_update_page_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -1719,7 +1719,7 @@ def test_update_page_with_if_modified_fail(self, resource_group, location, stora @GlobalStorageAccountPreparer() def test_update_page_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -1735,7 +1735,7 @@ def test_update_page_with_if_unmodified(self, resource_group, location, storage_ @GlobalStorageAccountPreparer() def test_update_page_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -1753,7 +1753,7 @@ def test_update_page_with_if_unmodified_fail(self, resource_group, location, sto @GlobalStorageAccountPreparer() def test_update_page_with_if_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -1768,7 +1768,7 @@ def test_update_page_with_if_match(self, resource_group, location, storage_accou @GlobalStorageAccountPreparer() def test_update_page_with_if_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -1784,7 +1784,7 @@ def test_update_page_with_if_match_fail(self, resource_group, location, storage_ @GlobalStorageAccountPreparer() def test_update_page_with_if_none_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -1798,7 +1798,7 @@ def test_update_page_with_if_none_match(self, resource_group, location, storage_ @GlobalStorageAccountPreparer() def test_update_page_with_if_none_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -1815,7 +1815,7 @@ def test_update_page_with_if_none_match_fail(self, resource_group, location, sto @GlobalStorageAccountPreparer() def test_get_page_ranges_iter_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -1835,7 +1835,7 @@ def test_get_page_ranges_iter_with_if_modified(self, resource_group, location, s @GlobalStorageAccountPreparer() def test_get_page_ranges_iter_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -1854,7 +1854,7 @@ def test_get_page_ranges_iter_with_if_modified_fail(self, resource_group, locati @GlobalStorageAccountPreparer() def test_get_page_ranges_iter_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -1874,7 +1874,7 @@ def test_get_page_ranges_iter_with_if_unmodified(self, resource_group, location, @GlobalStorageAccountPreparer() def test_get_page_ranges_iter_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -1893,7 +1893,7 @@ def test_get_page_ranges_iter_with_if_unmodified_fail(self, resource_group, loca @GlobalStorageAccountPreparer() def test_get_page_ranges_iter_with_if_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -1912,7 +1912,7 @@ def test_get_page_ranges_iter_with_if_match(self, resource_group, location, stor @GlobalStorageAccountPreparer() def test_get_page_ranges_iter_with_if_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -1929,7 +1929,7 @@ def test_get_page_ranges_iter_with_if_match_fail(self, resource_group, location, @GlobalStorageAccountPreparer() def test_get_page_ranges_iter_with_if_none_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -1947,7 +1947,7 @@ def test_get_page_ranges_iter_with_if_none_match(self, resource_group, location, @GlobalStorageAccountPreparer() def test_get_page_ranges_iter_with_if_none_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -1966,7 +1966,7 @@ def test_get_page_ranges_iter_with_if_none_match_fail(self, resource_group, loca @GlobalStorageAccountPreparer() def test_append_block_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_append_blob(self.container_name, 'blob1', bsc) test_datetime = (datetime.utcnow() - @@ -1982,7 +1982,7 @@ def test_append_block_with_if_modified(self, resource_group, location, storage_a @GlobalStorageAccountPreparer() def test_append_block_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_append_blob(self.container_name, 'blob1', bsc) test_datetime = (datetime.utcnow() + @@ -1997,7 +1997,7 @@ def test_append_block_with_if_modified_fail(self, resource_group, location, stor @GlobalStorageAccountPreparer() def test_append_block_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_append_blob(self.container_name, 'blob1', bsc) test_datetime = (datetime.utcnow() + @@ -2013,7 +2013,7 @@ def test_append_block_with_if_unmodified(self, resource_group, location, storage @GlobalStorageAccountPreparer() def test_append_block_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_append_blob(self.container_name, 'blob1', bsc) test_datetime = (datetime.utcnow() - @@ -2028,7 +2028,7 @@ def test_append_block_with_if_unmodified_fail(self, resource_group, location, st @GlobalStorageAccountPreparer() def test_append_block_with_if_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_append_blob(self.container_name, 'blob1', bsc) @@ -2044,7 +2044,7 @@ def test_append_block_with_if_match(self, resource_group, location, storage_acco @GlobalStorageAccountPreparer() def test_append_block_with_if_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_append_blob(self.container_name, 'blob1', bsc) @@ -2058,7 +2058,7 @@ def test_append_block_with_if_match_fail(self, resource_group, location, storage @GlobalStorageAccountPreparer() def test_append_block_with_if_none_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_append_blob(self.container_name, 'blob1', bsc) @@ -2073,7 +2073,7 @@ def test_append_block_with_if_none_match(self, resource_group, location, storage @GlobalStorageAccountPreparer() def test_append_block_with_if_none_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_append_blob(self.container_name, 'blob1', bsc) @@ -2088,7 +2088,7 @@ def test_append_block_with_if_none_match_fail(self, resource_group, location, st @GlobalStorageAccountPreparer() def test_append_blob_from_bytes_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() blob_name = self.get_resource_name("blob") container, blob = self._create_container_and_append_blob(self.container_name, blob_name, bsc) @@ -2104,7 +2104,7 @@ def test_append_blob_from_bytes_with_if_modified(self, resource_group, location, @GlobalStorageAccountPreparer() def test_append_blob_from_bytes_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() blob_name = self.get_resource_name("blob") container, blob = self._create_container_and_append_blob(self.container_name, blob_name, bsc) @@ -2119,7 +2119,7 @@ def test_append_blob_from_bytes_with_if_modified_fail(self, resource_group, loca @GlobalStorageAccountPreparer() def test_append_blob_from_bytes_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() blob_name = self.get_resource_name("blob") container, blob = self._create_container_and_append_blob(self.container_name, blob_name, bsc) @@ -2135,7 +2135,7 @@ def test_append_blob_from_bytes_with_if_unmodified(self, resource_group, locatio @GlobalStorageAccountPreparer() def test_append_blob_from_bytes_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() blob_name = self.get_resource_name("blob") container, blob = self._create_container_and_append_blob(self.container_name, blob_name, bsc) @@ -2150,7 +2150,7 @@ def test_append_blob_from_bytes_with_if_unmodified_fail(self, resource_group, lo @GlobalStorageAccountPreparer() def test_append_blob_from_bytes_with_if_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() blob_name = self.get_resource_name("blob") container, blob = self._create_container_and_append_blob(self.container_name, blob_name, bsc) @@ -2166,7 +2166,7 @@ def test_append_blob_from_bytes_with_if_match(self, resource_group, location, st @GlobalStorageAccountPreparer() def test_append_blob_from_bytes_with_if_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() blob_name = self.get_resource_name("blob") container, blob = self._create_container_and_append_blob(self.container_name, blob_name, bsc) @@ -2181,7 +2181,7 @@ def test_append_blob_from_bytes_with_if_match_fail(self, resource_group, locatio @GlobalStorageAccountPreparer() def test_append_blob_from_bytes_with_if_none_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() blob_name = self.get_resource_name("blob") container, blob = self._create_container_and_append_blob(self.container_name, blob_name, bsc) @@ -2197,7 +2197,7 @@ def test_append_blob_from_bytes_with_if_none_match(self, resource_group, locatio @GlobalStorageAccountPreparer() def test_append_blob_from_bytes_with_if_none_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024) self._setup() blob_name = self.get_resource_name("blob") container, blob = self._create_container_and_append_blob(self.container_name, blob_name, bsc) diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions_async.py b/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions_async.py index 6bd3419e85e7..66f1432b5f00 100644 --- a/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions_async.py @@ -87,7 +87,7 @@ async def _create_container_and_append_blob(self, container_name, blob_name, bsc @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_container_metadata_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container = await self._create_container(self.container_name, bsc) test_datetime = (datetime.utcnow() - @@ -104,7 +104,7 @@ async def test_set_container_metadata_with_if_modified(self, resource_group, loc @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_container_md_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container = await self._create_container(self.container_name, bsc) test_datetime = (datetime.utcnow() + @@ -121,7 +121,7 @@ async def test_set_container_md_with_if_modified_fail(self, resource_group, loca @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_container_acl_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container = await self._create_container(self.container_name, bsc) test_datetime = (datetime.utcnow() - @@ -140,7 +140,7 @@ async def test_set_container_acl_with_if_modified(self, resource_group, location @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_container_acl_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container = await self._create_container(self.container_name, bsc) test_datetime = (datetime.utcnow() + @@ -159,7 +159,7 @@ async def test_set_container_acl_with_if_modified_fail(self, resource_group, loc @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_container_acl_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container = await self._create_container(self.container_name, bsc) test_datetime = (datetime.utcnow() + @@ -179,7 +179,7 @@ async def test_set_container_acl_with_if_unmodified(self, resource_group, locati @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_container_acl_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container = await self._create_container(self.container_name, bsc) test_datetime = (datetime.utcnow() - @@ -198,7 +198,7 @@ async def test_set_container_acl_with_if_unmodified_fail(self, resource_group, l @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_lease_container_acquire_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container = await self._create_container(self.container_name, bsc) test_datetime = (datetime.utcnow() - @@ -213,7 +213,7 @@ async def test_lease_container_acquire_with_if_modified(self, resource_group, lo @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_lease_cont_acquire_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container = await self._create_container(self.container_name, bsc) test_datetime = (datetime.utcnow() + @@ -229,7 +229,7 @@ async def test_lease_cont_acquire_with_if_modified_fail(self, resource_group, lo @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_lease_container_acquire_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container = await self._create_container(self.container_name, bsc) test_datetime = (datetime.utcnow() + @@ -244,7 +244,7 @@ async def test_lease_container_acquire_with_if_unmodified(self, resource_group, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_lease_container_acquire_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container = await self._create_container(self.container_name, bsc) test_datetime = (datetime.utcnow() - @@ -260,7 +260,7 @@ async def test_lease_container_acquire_with_if_unmodified_fail(self, resource_gr @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_delete_container_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container = await self._create_container(self.container_name, bsc) test_datetime = (datetime.utcnow() - @@ -276,7 +276,7 @@ async def test_delete_container_with_if_modified(self, resource_group, location, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_delete_container_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container = await self._create_container(self.container_name, bsc) test_datetime = (datetime.utcnow() + @@ -290,7 +290,7 @@ async def test_delete_container_with_if_modified_fail(self, resource_group, loca @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_delete_container_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container = await self._create_container(self.container_name, bsc) test_datetime = (datetime.utcnow() + @@ -305,7 +305,7 @@ async def test_delete_container_with_if_unmodified(self, resource_group, locatio @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_delete_container_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container = await self._create_container(self.container_name, bsc) test_datetime = (datetime.utcnow() - @@ -319,7 +319,7 @@ async def test_delete_container_with_if_unmodified_fail(self, resource_group, lo @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_put_blob_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() data = b'hello world' container, blob = await self._create_container_and_block_blob( @@ -336,7 +336,7 @@ async def test_put_blob_with_if_modified(self, resource_group, location, storage @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_put_blob_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() data = b'hello world' container, blob = await self._create_container_and_block_blob( @@ -354,7 +354,7 @@ async def test_put_blob_with_if_modified_fail(self, resource_group, location, st @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_put_blob_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() data = b'hello world' container, blob = await self._create_container_and_block_blob( @@ -371,7 +371,7 @@ async def test_put_blob_with_if_unmodified(self, resource_group, location, stora @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_put_blob_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() data = b'hello world' container, blob = await self._create_container_and_block_blob( @@ -389,7 +389,7 @@ async def test_put_blob_with_if_unmodified_fail(self, resource_group, location, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_put_blob_with_if_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() data = b'hello world' container, blob = await self._create_container_and_block_blob( @@ -405,7 +405,7 @@ async def test_put_blob_with_if_match(self, resource_group, location, storage_ac @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_put_blob_with_if_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() data = b'hello world' container, blob = await self._create_container_and_block_blob( @@ -423,7 +423,7 @@ async def test_put_blob_with_if_match_fail(self, resource_group, location, stora @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_put_blob_with_if_none_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() data = b'hello world' container, blob = await self._create_container_and_block_blob( @@ -438,7 +438,7 @@ async def test_put_blob_with_if_none_match(self, resource_group, location, stora @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_put_blob_with_if_none_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() data = b'hello world' container, blob = await self._create_container_and_block_blob( @@ -455,7 +455,7 @@ async def test_put_blob_with_if_none_match_fail(self, resource_group, location, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -472,7 +472,7 @@ async def test_get_blob_with_if_modified(self, resource_group, location, storage @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -489,7 +489,7 @@ async def test_get_blob_with_if_modified_fail(self, resource_group, location, st @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -506,7 +506,7 @@ async def test_get_blob_with_if_unmodified(self, resource_group, location, stora @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -523,7 +523,7 @@ async def test_get_blob_with_if_unmodified_fail(self, resource_group, location, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_with_if_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -539,7 +539,7 @@ async def test_get_blob_with_if_match(self, resource_group, location, storage_ac @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_with_if_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -554,7 +554,7 @@ async def test_get_blob_with_if_match_fail(self, resource_group, location, stora @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_with_if_none_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -569,7 +569,7 @@ async def test_get_blob_with_if_none_match(self, resource_group, location, stora @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_with_if_none_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -585,7 +585,7 @@ async def test_get_blob_with_if_none_match_fail(self, resource_group, location, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_blob_props_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -606,7 +606,7 @@ async def test_set_blob_props_with_if_modified(self, resource_group, location, s @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_blob_props_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -626,7 +626,7 @@ async def test_set_blob_props_with_if_modified_fail(self, resource_group, locati @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_blob_props_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -647,7 +647,7 @@ async def test_set_blob_props_with_if_unmodified(self, resource_group, location, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_blob_props_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -667,7 +667,7 @@ async def test_set_blob_props_with_if_unmodified_fail(self, resource_group, loca @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_blob_props_with_if_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -688,7 +688,7 @@ async def test_set_blob_props_with_if_match(self, resource_group, location, stor @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_blob_props_with_if_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -707,7 +707,7 @@ async def test_set_blob_props_with_if_match_fail(self, resource_group, location, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_blob_props_with_if_none_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -727,7 +727,7 @@ async def test_set_blob_props_with_if_none_match(self, resource_group, location, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_blob_props_with_if_none_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -747,7 +747,7 @@ async def test_set_blob_props_with_if_none_match_fail(self, resource_group, loca @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_properties_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -766,7 +766,7 @@ async def test_get_blob_properties_with_if_modified(self, resource_group, locati @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_properties_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -783,7 +783,7 @@ async def test_get_blob_properties_with_if_modified_fail(self, resource_group, l @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_properties_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -802,7 +802,7 @@ async def test_get_blob_properties_with_if_unmodified(self, resource_group, loca @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_properties_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -819,7 +819,7 @@ async def test_get_blob_properties_with_if_unmodified_fail(self, resource_group, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_properties_with_if_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -838,7 +838,7 @@ async def test_get_blob_properties_with_if_match(self, resource_group, location, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_properties_with_if_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -854,7 +854,7 @@ async def test_get_blob_properties_with_if_match_fail(self, resource_group, loca @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_properties_with_if_none_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -872,7 +872,7 @@ async def test_get_blob_properties_with_if_none_match(self, resource_group, loca @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_properties_with_if_none_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -889,7 +889,7 @@ async def test_get_blob_properties_with_if_none_match_fail(self, resource_group, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_metadata_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -906,7 +906,7 @@ async def test_get_blob_metadata_with_if_modified(self, resource_group, location @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_metadata_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -924,7 +924,7 @@ async def test_get_blob_metadata_with_if_modified_fail(self, resource_group, loc @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_metadata_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -941,7 +941,7 @@ async def test_get_blob_metadata_with_if_unmodified(self, resource_group, locati @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_metadata_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -959,7 +959,7 @@ async def test_get_blob_metadata_with_if_unmodified_fail(self, resource_group, l @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_metadata_with_if_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -975,7 +975,7 @@ async def test_get_blob_metadata_with_if_match(self, resource_group, location, s @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_metadata_with_if_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -991,7 +991,7 @@ async def test_get_blob_metadata_with_if_match_fail(self, resource_group, locati @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_metadata_with_if_none_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1006,7 +1006,7 @@ async def test_get_blob_metadata_with_if_none_match(self, resource_group, locati @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_metadata_with_if_none_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1023,7 +1023,7 @@ async def test_get_blob_metadata_with_if_none_match_fail(self, resource_group, l @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_blob_metadata_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1042,7 +1042,7 @@ async def test_set_blob_metadata_with_if_modified(self, resource_group, location @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_blob_metadata_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1061,7 +1061,7 @@ async def test_set_blob_metadata_with_if_modified_fail(self, resource_group, loc @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_blob_metadata_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1080,7 +1080,7 @@ async def test_set_blob_metadata_with_if_unmodified(self, resource_group, locati @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_blob_metadata_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1099,7 +1099,7 @@ async def test_set_blob_metadata_with_if_unmodified_fail(self, resource_group, l @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_blob_metadata_with_if_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1117,7 +1117,7 @@ async def test_set_blob_metadata_with_if_match(self, resource_group, location, s @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_blob_metadata_with_if_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1134,7 +1134,7 @@ async def test_set_blob_metadata_with_if_match_fail(self, resource_group, locati @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_blob_metadata_with_if_none_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1151,7 +1151,7 @@ async def test_set_blob_metadata_with_if_none_match(self, resource_group, locati @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_blob_metadata_with_if_none_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1169,7 +1169,7 @@ async def test_set_blob_metadata_with_if_none_match_fail(self, resource_group, l @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_delete_blob_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() test_datetime = (datetime.utcnow() - timedelta(minutes=15)) @@ -1186,7 +1186,7 @@ async def test_delete_blob_with_if_modified(self, resource_group, location, stor @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_delete_blob_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() test_datetime = (datetime.utcnow() + timedelta(minutes=15)) @@ -1204,7 +1204,7 @@ async def test_delete_blob_with_if_modified_fail(self, resource_group, location, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_delete_blob_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() test_datetime = (datetime.utcnow() + timedelta(minutes=15)) @@ -1221,7 +1221,7 @@ async def test_delete_blob_with_if_unmodified(self, resource_group, location, st @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_delete_blob_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() test_datetime = (datetime.utcnow() - timedelta(minutes=15)) @@ -1239,7 +1239,7 @@ async def test_delete_blob_with_if_unmodified_fail(self, resource_group, locatio @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_delete_blob_with_if_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1256,7 +1256,7 @@ async def test_delete_blob_with_if_match(self, resource_group, location, storage @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_delete_blob_with_if_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1272,7 +1272,7 @@ async def test_delete_blob_with_if_match_fail(self, resource_group, location, st @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_delete_blob_with_if_none_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1287,7 +1287,7 @@ async def test_delete_blob_with_if_none_match(self, resource_group, location, st @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_delete_blob_with_if_none_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1304,7 +1304,7 @@ async def test_delete_blob_with_if_none_match_fail(self, resource_group, locatio @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_snapshot_blob_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1322,7 +1322,7 @@ async def test_snapshot_blob_with_if_modified(self, resource_group, location, st @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_snapshot_blob_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1340,7 +1340,7 @@ async def test_snapshot_blob_with_if_modified_fail(self, resource_group, locatio @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_snapshot_blob_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1358,7 +1358,7 @@ async def test_snapshot_blob_with_if_unmodified(self, resource_group, location, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_snapshot_blob_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1376,7 +1376,7 @@ async def test_snapshot_blob_with_if_unmodified_fail(self, resource_group, locat @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_snapshot_blob_with_if_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1393,7 +1393,7 @@ async def test_snapshot_blob_with_if_match(self, resource_group, location, stora @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_snapshot_blob_with_if_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1409,7 +1409,7 @@ async def test_snapshot_blob_with_if_match_fail(self, resource_group, location, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_snapshot_blob_with_if_none_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1425,7 +1425,7 @@ async def test_snapshot_blob_with_if_none_match(self, resource_group, location, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_snapshot_blob_with_if_none_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1442,7 +1442,7 @@ async def test_snapshot_blob_with_if_none_match_fail(self, resource_group, locat @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_lease_blob_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1465,7 +1465,7 @@ async def test_lease_blob_with_if_modified(self, resource_group, location, stora @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_lease_blob_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1483,7 +1483,7 @@ async def test_lease_blob_with_if_modified_fail(self, resource_group, location, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_lease_blob_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1506,7 +1506,7 @@ async def test_lease_blob_with_if_unmodified(self, resource_group, location, sto @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_lease_blob_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1524,7 +1524,7 @@ async def test_lease_blob_with_if_unmodified_fail(self, resource_group, location @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_lease_blob_with_if_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1546,7 +1546,7 @@ async def test_lease_blob_with_if_match(self, resource_group, location, storage_ @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_lease_blob_with_if_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1562,7 +1562,7 @@ async def test_lease_blob_with_if_match_fail(self, resource_group, location, sto @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_lease_blob_with_if_none_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1584,7 +1584,7 @@ async def test_lease_blob_with_if_none_match(self, resource_group, location, sto @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_lease_blob_with_if_none_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1601,7 +1601,7 @@ async def test_lease_blob_with_if_none_match_fail(self, resource_group, location @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_put_block_list_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -1624,7 +1624,7 @@ async def test_put_block_list_with_if_modified(self, resource_group, location, s @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_put_block_list_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -1647,7 +1647,7 @@ async def test_put_block_list_with_if_modified_fail(self, resource_group, locati @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_put_block_list_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -1670,7 +1670,7 @@ async def test_put_block_list_with_if_unmodified(self, resource_group, location, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_put_block_list_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -1693,7 +1693,7 @@ async def test_put_block_list_with_if_unmodified_fail(self, resource_group, loca @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_put_block_list_with_if_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -1715,7 +1715,7 @@ async def test_put_block_list_with_if_match(self, resource_group, location, stor @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_put_block_list_with_if_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -1736,7 +1736,7 @@ async def test_put_block_list_with_if_match_fail(self, resource_group, location, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_put_block_list_with_if_none_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -1757,7 +1757,7 @@ async def test_put_block_list_with_if_none_match(self, resource_group, location, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_put_block_list_with_if_none_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -1778,7 +1778,7 @@ async def test_put_block_list_with_if_none_match_fail(self, resource_group, loca @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_update_page_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -1795,7 +1795,7 @@ async def test_update_page_with_if_modified(self, resource_group, location, stor @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_update_page_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -1814,7 +1814,7 @@ async def test_update_page_with_if_modified_fail(self, resource_group, location, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_update_page_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -1831,7 +1831,7 @@ async def test_update_page_with_if_unmodified(self, resource_group, location, st @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_update_page_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -1850,7 +1850,7 @@ async def test_update_page_with_if_unmodified_fail(self, resource_group, locatio @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_update_page_with_if_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -1866,7 +1866,7 @@ async def test_update_page_with_if_match(self, resource_group, location, storage @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_update_page_with_if_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -1883,7 +1883,7 @@ async def test_update_page_with_if_match_fail(self, resource_group, location, st @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_update_page_with_if_none_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -1898,7 +1898,7 @@ async def test_update_page_with_if_none_match(self, resource_group, location, st @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_update_page_with_if_none_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() await self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -1916,7 +1916,7 @@ async def test_update_page_with_if_none_match_fail(self, resource_group, locatio @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_page_ranges_iter_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -1936,7 +1936,7 @@ async def test_get_page_ranges_iter_with_if_modified(self, resource_group, locat @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_page_ranges_iter_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -1955,7 +1955,7 @@ async def test_get_page_ranges_iter_with_if_modified_fail(self, resource_group, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_page_ranges_iter_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -1975,7 +1975,7 @@ async def test_get_page_ranges_iter_with_if_unmodified(self, resource_group, loc @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_page_ranges_iter_with_if_unmod_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -1994,7 +1994,7 @@ async def test_get_page_ranges_iter_with_if_unmod_fail(self, resource_group, loc @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_page_ranges_iter_with_if_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -2013,7 +2013,7 @@ async def test_get_page_ranges_iter_with_if_match(self, resource_group, location @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_page_ranges_iter_with_if_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -2030,7 +2030,7 @@ async def test_get_page_ranges_iter_with_if_match_fail(self, resource_group, loc @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_page_ranges_iter_with_if_none_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -2048,7 +2048,7 @@ async def test_get_page_ranges_iter_with_if_none_match(self, resource_group, loc @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_page_ranges_iter_if_none_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -2067,7 +2067,7 @@ async def test_get_page_ranges_iter_if_none_match_fail(self, resource_group, loc @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_append_block_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_append_blob(self.container_name, 'blob1', bsc) test_datetime = (datetime.utcnow() - @@ -2085,7 +2085,7 @@ async def test_append_block_with_if_modified(self, resource_group, location, sto @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_append_block_with_if_modified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_append_blob(self.container_name, 'blob1', bsc) test_datetime = (datetime.utcnow() + @@ -2101,7 +2101,7 @@ async def test_append_block_with_if_modified_fail(self, resource_group, location @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_append_block_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_append_blob(self.container_name, 'blob1', bsc) test_datetime = (datetime.utcnow() + @@ -2119,7 +2119,7 @@ async def test_append_block_with_if_unmodified(self, resource_group, location, s @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_append_block_with_if_unmodified_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_append_blob(self.container_name, 'blob1', bsc) test_datetime = (datetime.utcnow() - @@ -2135,7 +2135,7 @@ async def test_append_block_with_if_unmodified_fail(self, resource_group, locati @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_append_block_with_if_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_append_blob(self.container_name, 'blob1', bsc) @@ -2153,7 +2153,7 @@ async def test_append_block_with_if_match(self, resource_group, location, storag @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_append_block_with_if_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_append_blob(self.container_name, 'blob1', bsc) @@ -2168,7 +2168,7 @@ async def test_append_block_with_if_match_fail(self, resource_group, location, s @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_append_block_with_if_none_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_append_blob(self.container_name, 'blob1', bsc) @@ -2185,7 +2185,7 @@ async def test_append_block_with_if_none_match(self, resource_group, location, s @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_append_block_with_if_none_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() container, blob = await self._create_container_and_append_blob(self.container_name, 'blob1', bsc) @@ -2201,7 +2201,7 @@ async def test_append_block_with_if_none_match_fail(self, resource_group, locati @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_append_blob_from_bytes_with_if_modified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() blob_name = self.get_resource_name("blob") container, blob = await self._create_container_and_append_blob(self.container_name, blob_name, bsc) @@ -2219,7 +2219,7 @@ async def test_append_blob_from_bytes_with_if_modified(self, resource_group, loc @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_apnd_blob_from_bytes_with_if_mod_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() blob_name = self.get_resource_name("blob") container, blob = await self._create_container_and_append_blob(self.container_name, blob_name, bsc) @@ -2235,7 +2235,7 @@ async def test_apnd_blob_from_bytes_with_if_mod_fail(self, resource_group, locat @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_append_blob_from_bytes_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() blob_name = self.get_resource_name("blob") container, blob = await self._create_container_and_append_blob(self.container_name, blob_name, bsc) @@ -2253,7 +2253,7 @@ async def test_append_blob_from_bytes_with_if_unmodified(self, resource_group, l @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_append_blob_from_bytes_with_if_unmod_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() blob_name = self.get_resource_name("blob") container, blob = await self._create_container_and_append_blob(self.container_name, blob_name, bsc) @@ -2269,7 +2269,7 @@ async def test_append_blob_from_bytes_with_if_unmod_fail(self, resource_group, l @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_append_blob_from_bytes_with_if_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() blob_name = self.get_resource_name("blob") container, blob = await self._create_container_and_append_blob(self.container_name, blob_name, bsc) @@ -2287,7 +2287,7 @@ async def test_append_blob_from_bytes_with_if_match(self, resource_group, locati @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_append_blob_from_bytes_with_if_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() blob_name = self.get_resource_name("blob") container, blob = await self._create_container_and_append_blob(self.container_name, blob_name, bsc) @@ -2303,7 +2303,7 @@ async def test_append_blob_from_bytes_with_if_match_fail(self, resource_group, l @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_append_blob_from_bytes_with_if_none_match(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() blob_name = self.get_resource_name("blob") container, blob = await self._create_container_and_append_blob(self.container_name, blob_name, bsc) @@ -2321,7 +2321,7 @@ async def test_append_blob_from_bytes_with_if_none_match(self, resource_group, l @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_apnd_blob_from_bytes_if_none_match_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024, transport=AiohttpTestTransport()) self._setup() blob_name = self.get_resource_name("blob") container, blob = await self._create_container_and_append_blob(self.container_name, blob_name, bsc) diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_client.py b/sdk/storage/azure-storage-blob/tests/test_blob_client.py index 2c7c939cbfe0..8a79c7e4a5e3 100644 --- a/sdk/storage/azure-storage-blob/tests/test_blob_client.py +++ b/sdk/storage/azure-storage-blob/tests/test_blob_client.py @@ -53,7 +53,7 @@ def test_create_service_with_key(self, resource_group, location, storage_account for client, url in SERVICES.items(): # Act service = client( - self.account_url(storage_account.name, "blob"), credential=storage_account_key, container_name='foo', blob_name='bar') + self.account_url(storage_account, "blob"), credential=storage_account_key, container_name='foo', blob_name='bar') # Assert self.validate_standard_account_endpoints(service, url, storage_account.name, storage_account_key) @@ -63,7 +63,7 @@ def test_create_service_with_key(self, resource_group, location, storage_account @GlobalStorageAccountPreparer() def test_create_blob_client_with_complete_blob_url(self, resource_group, location, storage_account, storage_account_key): # Arrange - blob_url = self.account_url(storage_account.name, "blob") + "/foourl/barurl" + blob_url = self.account_url(storage_account, "blob") + "/foourl/barurl" service = BlobClient(blob_url, credential=storage_account_key, container_name='foo', blob_name='bar') # Assert @@ -91,7 +91,7 @@ def test_create_service_with_sas(self, resource_group, location, storage_account for service_type in SERVICES: # Act service = service_type( - self.account_url(storage_account.name, "blob"), credential=self.sas_token, container_name='foo', blob_name='bar') + self.account_url(storage_account, "blob"), credential=self.sas_token, container_name='foo', blob_name='bar') # Assert self.assertIsNotNone(service) @@ -105,7 +105,7 @@ def test_create_service_with_token(self, resource_group, location, storage_accou for service_type in SERVICES: # Act service = service_type( - self.account_url(storage_account.name, "blob"), credential=self.token_credential, container_name='foo', blob_name='bar') + self.account_url(storage_account, "blob"), credential=self.token_credential, container_name='foo', blob_name='bar') # Assert self.assertIsNotNone(service) @@ -118,7 +118,7 @@ def test_create_service_with_token_and_http(self, resource_group, location, stor for service_type in SERVICES: # Act with self.assertRaises(ValueError): - url = self.account_url(storage_account.name, "blob").replace('https', 'http') + url = self.account_url(storage_account, "blob").replace('https', 'http') service_type(url, credential=self.token_credential, container_name='foo', blob_name='bar') @GlobalStorageAccountPreparer() @@ -127,7 +127,7 @@ def test_create_service_china(self, resource_group, location, storage_account, s for service_type in SERVICES.items(): # Act - url = self.account_url(storage_account.name, "blob").replace('core.windows.net', 'core.chinacloudapi.cn') + url = self.account_url(storage_account, "blob").replace('core.windows.net', 'core.chinacloudapi.cn') service = service_type[0]( url, credential=storage_account_key, container_name='foo', blob_name='bar') @@ -147,7 +147,7 @@ def test_create_service_protocol(self, resource_group, location, storage_account for service_type in SERVICES.items(): # Act - url = self.account_url(storage_account.name, "blob").replace('https', 'http') + url = self.account_url(storage_account, "blob").replace('https', 'http') service = service_type[0]( url, credential=storage_account_key, container_name='foo', blob_name='bar') @@ -162,7 +162,7 @@ def test_create_blob_service_anonymous(self, resource_group, location, storage_a for service_type in BLOB_SERVICES: # Act - service = service_type(self.account_url(storage_account.name, "blob"), container_name='foo', blob_name='bar') + service = service_type(self.account_url(storage_account, "blob"), container_name='foo', blob_name='bar') # Assert self.assertIsNotNone(service) @@ -198,10 +198,10 @@ def test_create_service_with_socket_timeout(self, resource_group, location, stor for service_type in SERVICES.items(): # Act default_service = service_type[0]( - self.account_url(storage_account.name, "blob"), credential=storage_account_key, + self.account_url(storage_account, "blob"), credential=storage_account_key, container_name='foo', blob_name='bar') service = service_type[0]( - self.account_url(storage_account.name, "blob"), credential=storage_account_key, + self.account_url(storage_account, "blob"), credential=storage_account_key, container_name='foo', blob_name='bar', connection_timeout=22) # Assert @@ -441,7 +441,7 @@ def test_create_service_with_custom_account_endpoint_path(self): @GlobalStorageAccountPreparer() def test_request_callback_signed_header(self, resource_group, location, storage_account, storage_account_key): # Arrange - service = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key) + service = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key) name = self.get_resource_name('cont') # Act @@ -460,7 +460,7 @@ def callback(request): @GlobalStorageAccountPreparer() def test_response_callback(self, resource_group, location, storage_account, storage_account_key): # Arrange - service = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key) + service = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key) name = self.get_resource_name('cont') container = service.get_container_client(name) @@ -481,7 +481,7 @@ def test_client_request_id_echo(self, resource_group, location, storage_account, # Arrange request_id_header_name = 'x-ms-client-request-id' - service = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key) + service = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key) # Act make the client request ID slightly different def callback(response): @@ -502,7 +502,7 @@ def callback(response): @GlobalStorageAccountPreparer() def test_user_agent_default(self, resource_group, location, storage_account, storage_account_key): - service = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key) + service = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key) def callback(response): self.assertTrue('User-Agent' in response.http_request.headers) @@ -519,7 +519,7 @@ def callback(response): def test_user_agent_custom(self, resource_group, location, storage_account, storage_account_key): custom_app = "TestApp/v1.0" service = BlobServiceClient( - self.account_url(storage_account.name, "blob"), credential=storage_account_key, user_agent=custom_app) + self.account_url(storage_account, "blob"), credential=storage_account_key, user_agent=custom_app) def callback(response): self.assertTrue('User-Agent' in response.http_request.headers) @@ -545,7 +545,7 @@ def callback(response): @GlobalStorageAccountPreparer() def test_user_agent_append(self, resource_group, location, storage_account, storage_account_key): - service = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key) + service = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key) def callback(response): self.assertTrue('User-Agent' in response.http_request.headers) @@ -580,7 +580,7 @@ def test_closing_pipeline_client(self, resource_group, location, storage_account for client, url in SERVICES.items(): # Act service = client( - self.account_url(storage_account.name, "blob"), credential=storage_account_key, container_name='foo', blob_name='bar') + self.account_url(storage_account, "blob"), credential=storage_account_key, container_name='foo', blob_name='bar') # Assert with service: @@ -593,7 +593,7 @@ def test_closing_pipeline_client_simple(self, resource_group, location, storage_ for client, url in SERVICES.items(): # Act service = client( - self.account_url(storage_account.name, "blob"), credential=storage_account_key, container_name='foo', blob_name='bar') + self.account_url(storage_account, "blob"), credential=storage_account_key, container_name='foo', blob_name='bar') service.close() # ------------------------------------------------------------------------------ diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_client_async.py b/sdk/storage/azure-storage-blob/tests/test_blob_client_async.py index 22acedca7236..d28345147c43 100644 --- a/sdk/storage/azure-storage-blob/tests/test_blob_client_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_blob_client_async.py @@ -66,7 +66,7 @@ def test_create_service_with_key_async(self, resource_group, location, storage_a for client, url in SERVICES.items(): # Act service = client( - self.account_url(storage_account.name, "blob"), credential=storage_account_key, container_name='foo', blob_name='bar') + self.account_url(storage_account, "blob"), credential=storage_account_key, container_name='foo', blob_name='bar') # Assert self.validate_standard_account_endpoints(service, url, storage_account.name, storage_account_key) @@ -91,7 +91,7 @@ def test_create_service_with_sas_async(self, resource_group, location, storage_a for service_type in SERVICES: # Act service = service_type( - self.account_url(storage_account.name, "blob"), credential=self.sas_token, container_name='foo', blob_name='bar') + self.account_url(storage_account, "blob"), credential=self.sas_token, container_name='foo', blob_name='bar') # Assert self.assertIsNotNone(service) @@ -105,7 +105,7 @@ def test_create_service_with_token_async(self, resource_group, location, storage for service_type in SERVICES: # Act service = service_type( - self.account_url(storage_account.name, "blob"), credential=self.token_credential, container_name='foo', blob_name='bar') + self.account_url(storage_account, "blob"), credential=self.token_credential, container_name='foo', blob_name='bar') # Assert self.assertIsNotNone(service) @@ -118,7 +118,7 @@ def test_create_service_with_token_and_http_async(self, resource_group, location for service_type in SERVICES: # Act with self.assertRaises(ValueError): - url = self.account_url(storage_account.name, "blob").replace('https', 'http') + url = self.account_url(storage_account, "blob").replace('https', 'http') service_type(url, credential=self.token_credential, container_name='foo', blob_name='bar') @GlobalStorageAccountPreparer() @@ -127,7 +127,7 @@ def test_create_service_china_async(self, resource_group, location, storage_acco for service_type in SERVICES.items(): # Act - url = self.account_url(storage_account.name, "blob").replace('core.windows.net', 'core.chinacloudapi.cn') + url = self.account_url(storage_account, "blob").replace('core.windows.net', 'core.chinacloudapi.cn') service = service_type[0]( url, credential=storage_account_key, container_name='foo', blob_name='bar') @@ -147,7 +147,7 @@ def test_create_service_protocol_async(self, resource_group, location, storage_a for service_type in SERVICES.items(): # Act - url = self.account_url(storage_account.name, "blob").replace('https', 'http') + url = self.account_url(storage_account, "blob").replace('https', 'http') service = service_type[0]( url, credential=storage_account_key, container_name='foo', blob_name='bar') @@ -162,7 +162,7 @@ def test_create_blob_service_anonymous_async(self, resource_group, location, sto for service_type in BLOB_SERVICES: # Act - service = service_type(self.account_url(storage_account.name, "blob"), container_name='foo', blob_name='bar') + service = service_type(self.account_url(storage_account, "blob"), container_name='foo', blob_name='bar') # Assert self.assertIsNotNone(service) @@ -198,10 +198,10 @@ def test_create_service_with_socket_timeout_async(self, resource_group, location for service_type in SERVICES.items(): # Act default_service = service_type[0]( - self.account_url(storage_account.name, "blob"), credential=storage_account_key, + self.account_url(storage_account, "blob"), credential=storage_account_key, container_name='foo', blob_name='bar') service = service_type[0]( - self.account_url(storage_account.name, "blob"), credential=storage_account_key, + self.account_url(storage_account, "blob"), credential=storage_account_key, container_name='foo', blob_name='bar', connection_timeout=22) # Assert @@ -244,7 +244,7 @@ def test_create_service_with_connection_string_sas_async(self, resource_group, l @GlobalStorageAccountPreparer() def test_create_blob_client_with_complete_blob_url_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - blob_url = self.account_url(storage_account.name, "blob") + "/foourl/barurl" + blob_url = self.account_url(storage_account, "blob") + "/foourl/barurl" service = BlobClient(blob_url, credential=storage_account_key, container_name='foo', blob_name='bar') # Assert @@ -453,7 +453,7 @@ def test_create_service_with_custom_account_endpoint_path(self): @AsyncStorageTestCase.await_prepared_test async def test_request_callback_signed_header_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - service = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) + service = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) name = self.get_resource_name('cont') # Act @@ -473,7 +473,7 @@ def callback(request): @AsyncStorageTestCase.await_prepared_test async def test_response_callback_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - service = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) + service = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) name = self.get_resource_name('cont') container = service.get_container_client(name) @@ -489,7 +489,7 @@ def callback(response): @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_user_agent_default_async(self, resource_group, location, storage_account, storage_account_key): - service = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) + service = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) def callback(response): self.assertTrue('User-Agent' in response.http_request.headers) @@ -507,7 +507,7 @@ def callback(response): async def test_user_agent_custom_async(self, resource_group, location, storage_account, storage_account_key): custom_app = "TestApp/v1.0" service = BlobServiceClient( - self.account_url(storage_account.name, "blob"), credential=storage_account_key, user_agent=custom_app, transport=AiohttpTestTransport()) + self.account_url(storage_account, "blob"), credential=storage_account_key, user_agent=custom_app, transport=AiohttpTestTransport()) def callback(response): self.assertTrue('User-Agent' in response.http_request.headers) @@ -534,7 +534,7 @@ def callback(response): @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_user_agent_append_async(self, resource_group, location, storage_account, storage_account_key): - service = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) + service = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) def callback(response): self.assertTrue('User-Agent' in response.http_request.headers) @@ -549,27 +549,29 @@ def callback(response): await service.get_service_properties(raw_response_hook=callback, headers=custom_headers) @GlobalStorageAccountPreparer() + @AsyncStorageTestCase.await_prepared_test async def test_closing_pipeline_client(self, resource_group, location, storage_account, storage_account_key): # Arrange for client, url in SERVICES.items(): # Act service = client( - self.account_url(storage_account.name, "blob"), credential=storage_account_key, container_name='foo', blob_name='bar') + self.account_url(storage_account, "blob"), credential=storage_account_key, container_name='foo', blob_name='bar') # Assert async with service: assert hasattr(service, 'close') - service.close() + await service.close() @GlobalStorageAccountPreparer() + @AsyncStorageTestCase.await_prepared_test async def test_closing_pipeline_client_simple(self, resource_group, location, storage_account, storage_account_key): # Arrange for client, url in SERVICES.items(): # Act service = client( - self.account_url(storage_account.name, "blob"), credential=storage_account_key, container_name='foo', blob_name='bar') - service.close() + self.account_url(storage_account, "blob"), credential=storage_account_key, container_name='foo', blob_name='bar') + await service.close() # ------------------------------------------------------------------------------ diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_encryption.py b/sdk/storage/azure-storage-blob/tests/test_blob_encryption.py index 20534502201d..79b6a9899749 100644 --- a/sdk/storage/azure-storage-blob/tests/test_blob_encryption.py +++ b/sdk/storage/azure-storage-blob/tests/test_blob_encryption.py @@ -52,9 +52,9 @@ class StorageBlobEncryptionTest(StorageTestCase): # --Helpers----------------------------------------------------------------- - def _setup(self, name, key): + def _setup(self, storage_account, key): self.bsc = BlobServiceClient( - self.account_url(name, "blob"), + self.account_url(storage_account, "blob"), credential=key, max_single_put_size=32 * 1024, max_block_size=4 * 1024, @@ -94,7 +94,7 @@ def _create_small_blob(self, blob_type): @GlobalStorageAccountPreparer() def test_missing_attribute_kek_wrap(self, resource_group, location, storage_account, storage_account_key): # In the shared method _generate_blob_encryption_key - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self.bsc.require_encryption = True valid_key = KeyWrapper('key1') @@ -125,7 +125,7 @@ def test_missing_attribute_kek_wrap(self, resource_group, location, storage_acco @GlobalStorageAccountPreparer() def test_invalid_value_kek_wrap(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self.bsc.require_encryption = True self.bsc.key_encryption_key = KeyWrapper('key1') @@ -149,7 +149,7 @@ def test_invalid_value_kek_wrap(self, resource_group, location, storage_account, @GlobalStorageAccountPreparer() def test_missing_attribute_kek_unwrap(self, resource_group, location, storage_account, storage_account_key): # Shared between all services in decrypt_blob - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self.bsc.require_encryption = True valid_key = KeyWrapper('key1') self.bsc.key_encryption_key = valid_key @@ -175,7 +175,7 @@ def test_missing_attribute_kek_unwrap(self, resource_group, location, storage_ac @pytest.mark.live_test_only @GlobalStorageAccountPreparer() def test_invalid_value_kek_unwrap(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self.bsc.require_encryption = True self.bsc.key_encryption_key = KeyWrapper('key1') blob = self._create_small_blob(BlobType.BlockBlob) @@ -190,7 +190,7 @@ def test_invalid_value_kek_unwrap(self, resource_group, location, storage_accoun @GlobalStorageAccountPreparer() def test_get_blob_kek(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self.bsc.require_encryption = True self.bsc.key_encryption_key = KeyWrapper('key1') blob = self._create_small_blob(BlobType.BlockBlob) @@ -204,7 +204,7 @@ def test_get_blob_kek(self, resource_group, location, storage_account, storage_a @GlobalStorageAccountPreparer() def test_get_blob_resolver(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self.bsc.require_encryption = True self.bsc.key_encryption_key = KeyWrapper('key1') key_resolver = KeyResolver() @@ -224,7 +224,7 @@ def test_get_blob_resolver(self, resource_group, location, storage_account, stor def test_get_blob_kek_RSA(self, resource_group, location, storage_account, storage_account_key): # We can only generate random RSA keys, so this must be run live or # the playback test will fail due to a change in kek values. - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self.bsc.require_encryption = True self.bsc.key_encryption_key = RSAKeyWrapper('key2') blob = self._create_small_blob(BlobType.BlockBlob) @@ -238,7 +238,7 @@ def test_get_blob_kek_RSA(self, resource_group, location, storage_account, stora @pytest.mark.live_test_only @GlobalStorageAccountPreparer() def test_get_blob_nonmatching_kid(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self.bsc.require_encryption = True self.bsc.key_encryption_key = KeyWrapper('key1') blob = self._create_small_blob(BlobType.BlockBlob) @@ -253,7 +253,7 @@ def test_get_blob_nonmatching_kid(self, resource_group, location, storage_accoun @GlobalStorageAccountPreparer() def test_put_blob_invalid_stream_type(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self.bsc.require_encryption = True self.bsc.key_encryption_key = KeyWrapper('key1') small_stream = StringIO(u'small') @@ -277,7 +277,7 @@ def test_put_blob_invalid_stream_type(self, resource_group, location, storage_ac def test_put_blob_chunking_required_mult_of_block_size(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self.bsc.key_encryption_key = KeyWrapper('key1') self.bsc.require_encryption = True content = self.get_random_bytes( @@ -297,7 +297,7 @@ def test_put_blob_chunking_required_mult_of_block_size(self, resource_group, loc def test_put_blob_chunking_required_non_mult_of_block_size(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self.bsc.key_encryption_key = KeyWrapper('key1') self.bsc.require_encryption = True content = urandom(self.config.max_single_put_size + 1) @@ -316,7 +316,7 @@ def test_put_blob_chunking_required_non_mult_of_block_size(self, resource_group, def test_put_blob_chunking_required_range_specified(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self.bsc.key_encryption_key = KeyWrapper('key1') self.bsc.require_encryption = True content = self.get_random_bytes(self.config.max_single_put_size * 2) @@ -335,7 +335,7 @@ def test_put_blob_chunking_required_range_specified(self, resource_group, locati @GlobalStorageAccountPreparer() def test_put_block_blob_single_shot(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self.bsc.key_encryption_key = KeyWrapper('key1') self.bsc.require_encryption = True content = b'small' @@ -351,7 +351,7 @@ def test_put_block_blob_single_shot(self, resource_group, location, storage_acco @GlobalStorageAccountPreparer() def test_put_blob_range(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self.bsc.require_encryption = True self.bsc.key_encryption_key = KeyWrapper('key1') content = b'Random repeats' * self.config.max_single_put_size * 5 @@ -373,7 +373,7 @@ def test_put_blob_range(self, resource_group, location, storage_account, storage @GlobalStorageAccountPreparer() def test_put_blob_empty(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self.bsc.key_encryption_key = KeyWrapper('key1') self.bsc.require_encryption = True content = b'' @@ -389,7 +389,7 @@ def test_put_blob_empty(self, resource_group, location, storage_account, storage @GlobalStorageAccountPreparer() def test_put_blob_serial_upload_chunking(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self.bsc.key_encryption_key = KeyWrapper('key1') self.bsc.require_encryption = True content = self.get_random_bytes(self.config.max_single_put_size + 1) @@ -405,7 +405,7 @@ def test_put_blob_serial_upload_chunking(self, resource_group, location, storage @GlobalStorageAccountPreparer() def test_get_blob_range_beginning_to_middle(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self.bsc.key_encryption_key = KeyWrapper('key1') self.bsc.require_encryption = True content = self.get_random_bytes(128) @@ -421,7 +421,7 @@ def test_get_blob_range_beginning_to_middle(self, resource_group, location, stor @GlobalStorageAccountPreparer() def test_get_blob_range_middle_to_end(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self.bsc.key_encryption_key = KeyWrapper('key1') self.bsc.require_encryption = True content = self.get_random_bytes(128) @@ -439,7 +439,7 @@ def test_get_blob_range_middle_to_end(self, resource_group, location, storage_ac @GlobalStorageAccountPreparer() def test_get_blob_range_middle_to_middle(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self.bsc.key_encryption_key = KeyWrapper('key1') self.bsc.require_encryption = True content = self.get_random_bytes(128) @@ -456,7 +456,7 @@ def test_get_blob_range_middle_to_middle(self, resource_group, location, storage @GlobalStorageAccountPreparer() def test_get_blob_range_aligns_on_16_byte_block(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self.bsc.key_encryption_key = KeyWrapper('key1') self.bsc.require_encryption = True content = self.get_random_bytes(128) @@ -473,7 +473,7 @@ def test_get_blob_range_aligns_on_16_byte_block(self, resource_group, location, @GlobalStorageAccountPreparer() def test_get_blob_range_expanded_to_beginning_block_align(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self.bsc.key_encryption_key = KeyWrapper('key1') self.bsc.require_encryption = True content = self.get_random_bytes(128) @@ -490,7 +490,7 @@ def test_get_blob_range_expanded_to_beginning_block_align(self, resource_group, @GlobalStorageAccountPreparer() def test_get_blob_range_expanded_to_beginning_iv(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self.bsc.key_encryption_key = KeyWrapper('key1') self.bsc.require_encryption = True content = self.get_random_bytes(128) @@ -506,7 +506,7 @@ def test_get_blob_range_expanded_to_beginning_iv(self, resource_group, location, @GlobalStorageAccountPreparer() def test_put_blob_strict_mode(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self.bsc.require_encryption = True content = urandom(512) @@ -535,7 +535,7 @@ def test_put_blob_strict_mode(self, resource_group, location, storage_account, s @GlobalStorageAccountPreparer() def test_get_blob_strict_mode_no_policy(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self.bsc.require_encryption = True self.bsc.key_encryption_key = KeyWrapper('key1') blob = self._create_small_blob(BlobType.BlockBlob) @@ -550,7 +550,7 @@ def test_get_blob_strict_mode_no_policy(self, resource_group, location, storage_ @GlobalStorageAccountPreparer() def test_get_blob_strict_mode_unencrypted_blob(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob = self._create_small_blob(BlobType.BlockBlob) # Act @@ -563,7 +563,7 @@ def test_get_blob_strict_mode_unencrypted_blob(self, resource_group, location, s @GlobalStorageAccountPreparer() def test_invalid_methods_fail_block(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self.bsc.key_encryption_key = KeyWrapper('key1') blob_name = self._get_blob_reference(BlobType.BlockBlob) blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -579,7 +579,7 @@ def test_invalid_methods_fail_block(self, resource_group, location, storage_acco @GlobalStorageAccountPreparer() def test_invalid_methods_fail_append(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self.bsc.key_encryption_key = KeyWrapper('key1') blob_name = self._get_blob_reference(BlobType.AppendBlob) blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -600,7 +600,7 @@ def test_invalid_methods_fail_append(self, resource_group, location, storage_acc @GlobalStorageAccountPreparer() def test_invalid_methods_fail_page(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self.bsc.key_encryption_key = KeyWrapper('key1') blob_name = self._get_blob_reference(BlobType.PageBlob) blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -616,7 +616,7 @@ def test_invalid_methods_fail_page(self, resource_group, location, storage_accou @GlobalStorageAccountPreparer() def test_validate_encryption(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self.bsc.require_encryption = True kek = KeyWrapper('key1') self.bsc.key_encryption_key = kek @@ -642,7 +642,7 @@ def test_validate_encryption(self, resource_group, location, storage_account, st @GlobalStorageAccountPreparer() def test_create_block_blob_from_star(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self._create_blob_from_star(BlobType.BlockBlob, self.bytes, self.bytes) stream = BytesIO(self.bytes) @@ -659,7 +659,7 @@ def test_create_block_blob_from_star(self, resource_group, location, storage_acc @GlobalStorageAccountPreparer() def test_create_page_blob_from_star(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) content = self.get_random_bytes(512) self._create_blob_from_star(BlobType.PageBlob, content, content) @@ -687,7 +687,7 @@ def _create_blob_from_star(self, blob_type, content, data, **kwargs): @GlobalStorageAccountPreparer() def test_get_blob_to_star(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self.bsc.require_encryption = True self.bsc.key_encryption_key = KeyWrapper('key1') blob = self._create_small_blob(BlobType.BlockBlob) diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_encryption_async.py b/sdk/storage/azure-storage-blob/tests/test_blob_encryption_async.py index 2ec3124b10b4..4fdcb3f8a418 100644 --- a/sdk/storage/azure-storage-blob/tests/test_blob_encryption_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_blob_encryption_async.py @@ -73,12 +73,12 @@ async def send(self, request, **config): class StorageBlobEncryptionTestAsync(AsyncStorageTestCase): # --Helpers----------------------------------------------------------------- - async def _setup(self, name, key): + async def _setup(self, storage_account, key): # test chunking functionality by reducing the threshold # for chunking and the size of each chunk, otherwise # the tests would take too long to execute self.bsc = BlobServiceClient( - self.account_url(name, "blob"), + self.account_url(storage_account, "blob"), credential=key, max_single_put_size=32 * 1024, max_block_size=4 * 1024, @@ -123,7 +123,7 @@ async def _create_small_blob(self, blob_type): async def test_missing_attribute_kek_wrap_async(self, resource_group, location, storage_account, storage_account_key): # In the shared method _generate_blob_encryption_key - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) self.bsc.require_encryption = True valid_key = KeyWrapper('key1') @@ -155,7 +155,7 @@ async def test_missing_attribute_kek_wrap_async(self, resource_group, location, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_invalid_value_kek_wrap_async(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) self.bsc.require_encryption = True self.bsc.key_encryption_key = KeyWrapper('key1') @@ -181,7 +181,7 @@ async def test_invalid_value_kek_wrap_async(self, resource_group, location, stor async def test_missing_attribute_kek_unwrap_async(self, resource_group, location, storage_account, storage_account_key): # Shared between all services in decrypt_blob - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) self.bsc.require_encryption = True valid_key = KeyWrapper('key1') self.bsc.key_encryption_key = valid_key @@ -208,7 +208,7 @@ async def test_missing_attribute_kek_unwrap_async(self, resource_group, location @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_invalid_value_kek_unwrap_async(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) self.bsc.require_encryption = True self.bsc.key_encryption_key = KeyWrapper('key1') blob = await self._create_small_blob(BlobType.BlockBlob) @@ -224,7 +224,7 @@ async def test_invalid_value_kek_unwrap_async(self, resource_group, location, st @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_kek_async(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) self.bsc.require_encryption = True self.bsc.key_encryption_key = KeyWrapper('key1') blob = await self._create_small_blob(BlobType.BlockBlob) @@ -238,7 +238,7 @@ async def test_get_blob_kek_async(self, resource_group, location, storage_accoun @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_resolver_async(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) self.bsc.require_encryption = True self.bsc.key_encryption_key = KeyWrapper('key1') key_resolver = KeyResolver() @@ -260,7 +260,7 @@ async def test_get_blob_kek_RSA_async(self, resource_group, location, storage_ac # We can only generate random RSA keys, so this must be run live or # the playback test will fail due to a change in kek values. - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) self.bsc.require_encryption = True self.bsc.key_encryption_key = RSAKeyWrapper('key2') blob = await self._create_small_blob(BlobType.BlockBlob) @@ -278,7 +278,7 @@ async def test_get_blob_kek_RSA_async(self, resource_group, location, storage_ac @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_nonmatching_kid_async(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) self.bsc.require_encryption = True self.bsc.key_encryption_key = KeyWrapper('key1') blob = await self._create_small_blob(BlobType.BlockBlob) @@ -295,7 +295,7 @@ async def test_get_blob_nonmatching_kid_async(self, resource_group, location, st @AsyncStorageTestCase.await_prepared_test async def test_put_blob_invalid_stream_type_async(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) self.bsc.require_encryption = True self.bsc.key_encryption_key = KeyWrapper('key1') small_stream = StringIO(u'small') @@ -320,7 +320,7 @@ async def test_put_blob_invalid_stream_type_async(self, resource_group, location async def test_put_blob_chnking_reqd_mult_of_block_size_async(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) self.bsc.key_encryption_key = KeyWrapper('key1') self.bsc.require_encryption = True content = self.get_random_bytes( @@ -341,7 +341,7 @@ async def test_put_blob_chnking_reqd_mult_of_block_size_async(self, resource_gro async def test_put_blob_chnking_reqd_non_mult_of_block_size_async(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) self.bsc.key_encryption_key = KeyWrapper('key1') self.bsc.require_encryption = True content = urandom(self.config.max_single_put_size + 1) @@ -361,7 +361,7 @@ async def test_put_blob_chnking_reqd_non_mult_of_block_size_async(self, resource async def test_put_blob_chunking_required_range_specified_async(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) self.bsc.key_encryption_key = KeyWrapper('key1') self.bsc.require_encryption = True content = self.get_random_bytes(self.config.max_single_put_size * 2) @@ -382,7 +382,7 @@ async def test_put_blob_chunking_required_range_specified_async(self, resource_g @AsyncStorageTestCase.await_prepared_test async def test_put_block_blob_single_shot_async(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) self.bsc.key_encryption_key = KeyWrapper('key1') self.bsc.require_encryption = True content = b'small' @@ -399,7 +399,7 @@ async def test_put_block_blob_single_shot_async(self, resource_group, location, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_put_blob_range_async(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) self.bsc.require_encryption = True self.bsc.key_encryption_key = KeyWrapper('key1') content = b'Random repeats' * self.config.max_single_put_size * 5 @@ -422,7 +422,7 @@ async def test_put_blob_range_async(self, resource_group, location, storage_acco @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_put_blob_empty_async(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) self.bsc.key_encryption_key = KeyWrapper('key1') self.bsc.require_encryption = True content = b'' @@ -440,7 +440,7 @@ async def test_put_blob_empty_async(self, resource_group, location, storage_acco @AsyncStorageTestCase.await_prepared_test async def test_put_blob_serial_upload_chunking_async(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) self.bsc.key_encryption_key = KeyWrapper('key1') self.bsc.require_encryption = True content = self.get_random_bytes(self.config.max_single_put_size + 1) @@ -458,7 +458,7 @@ async def test_put_blob_serial_upload_chunking_async(self, resource_group, locat @AsyncStorageTestCase.await_prepared_test async def test_get_blob_range_beginning_to_middle_async(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) self.bsc.key_encryption_key = KeyWrapper('key1') self.bsc.require_encryption = True content = self.get_random_bytes(128) @@ -476,7 +476,7 @@ async def test_get_blob_range_beginning_to_middle_async(self, resource_group, lo @AsyncStorageTestCase.await_prepared_test async def test_get_blob_range_middle_to_end_async(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) self.bsc.key_encryption_key = KeyWrapper('key1') self.bsc.require_encryption = True content = self.get_random_bytes(128) @@ -496,7 +496,7 @@ async def test_get_blob_range_middle_to_end_async(self, resource_group, location @AsyncStorageTestCase.await_prepared_test async def test_get_blob_range_middle_to_middle_async(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) self.bsc.key_encryption_key = KeyWrapper('key1') self.bsc.require_encryption = True content = self.get_random_bytes(128) @@ -514,7 +514,7 @@ async def test_get_blob_range_middle_to_middle_async(self, resource_group, locat @AsyncStorageTestCase.await_prepared_test async def test_get_blob_range_aligns_on_16_byte_block_async(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) self.bsc.key_encryption_key = KeyWrapper('key1') self.bsc.require_encryption = True content = self.get_random_bytes(128) @@ -532,7 +532,7 @@ async def test_get_blob_range_aligns_on_16_byte_block_async(self, resource_group @AsyncStorageTestCase.await_prepared_test async def test_get_blob_range_expnded_to_begin_bloc_align_async(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) self.bsc.key_encryption_key = KeyWrapper('key1') self.bsc.require_encryption = True content = self.get_random_bytes(128) @@ -550,7 +550,7 @@ async def test_get_blob_range_expnded_to_begin_bloc_align_async(self, resource_g @AsyncStorageTestCase.await_prepared_test async def test_get_blob_range_expanded_to_beginning_iv_async(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) self.bsc.key_encryption_key = KeyWrapper('key1') self.bsc.require_encryption = True content = self.get_random_bytes(128) @@ -567,7 +567,7 @@ async def test_get_blob_range_expanded_to_beginning_iv_async(self, resource_grou @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_put_blob_strict_mode_async(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) self.bsc.require_encryption = True content = urandom(512) @@ -598,7 +598,7 @@ async def test_put_blob_strict_mode_async(self, resource_group, location, storag @AsyncStorageTestCase.await_prepared_test async def test_get_blob_strict_mode_no_policy_async(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) self.bsc.require_encryption = True self.bsc.key_encryption_key = KeyWrapper('key1') blob = await self._create_small_blob(BlobType.BlockBlob) @@ -614,7 +614,7 @@ async def test_get_blob_strict_mode_no_policy_async(self, resource_group, locati @AsyncStorageTestCase.await_prepared_test async def test_get_blob_strict_mode_unencrypted_blob_async(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob = await self._create_small_blob(BlobType.BlockBlob) # Act @@ -629,7 +629,7 @@ async def test_get_blob_strict_mode_unencrypted_blob_async(self, resource_group, @AsyncStorageTestCase.await_prepared_test async def test_invalid_methods_fail_block_async(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) self.bsc.key_encryption_key = KeyWrapper('key1') blob_name = self._get_blob_reference(BlobType.BlockBlob) blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -647,7 +647,7 @@ async def test_invalid_methods_fail_block_async(self, resource_group, location, @AsyncStorageTestCase.await_prepared_test async def test_invalid_methods_fail_append_async(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) self.bsc.key_encryption_key = KeyWrapper('key1') blob_name = self._get_blob_reference(BlobType.AppendBlob) blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -670,7 +670,7 @@ async def test_invalid_methods_fail_append_async(self, resource_group, location, @AsyncStorageTestCase.await_prepared_test async def test_invalid_methods_fail_page_async(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) self.bsc.key_encryption_key = KeyWrapper('key1') blob_name = self._get_blob_reference(BlobType.PageBlob) blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -687,7 +687,7 @@ async def test_invalid_methods_fail_page_async(self, resource_group, location, s @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_validate_encryption_async(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) self.bsc.require_encryption = True kek = KeyWrapper('key1') self.bsc.key_encryption_key = kek @@ -715,7 +715,7 @@ async def test_validate_encryption_async(self, resource_group, location, storage @AsyncStorageTestCase.await_prepared_test async def test_create_block_blob_from_star_async(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) await self._create_blob_from_star(BlobType.BlockBlob, "blob1", self.bytes, self.bytes) stream = BytesIO(self.bytes) @@ -734,7 +734,7 @@ async def test_create_block_blob_from_star_async(self, resource_group, location, @AsyncStorageTestCase.await_prepared_test async def test_create_page_blob_from_star_async(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) content = self.get_random_bytes(512) await self._create_blob_from_star(BlobType.PageBlob, "blob1", content, content) @@ -761,7 +761,7 @@ async def _create_blob_from_star(self, blob_type, blob_name, content, data, **kw @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_blob_to_star_async(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) self.bsc.require_encryption = True self.bsc.key_encryption_key = KeyWrapper('key1') blob = await self._create_small_blob(BlobType.BlockBlob) diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_retry.py b/sdk/storage/azure-storage-blob/tests/test_blob_retry.py index 827a9de45e35..cec89834215d 100644 --- a/sdk/storage/azure-storage-blob/tests/test_blob_retry.py +++ b/sdk/storage/azure-storage-blob/tests/test_blob_retry.py @@ -58,7 +58,7 @@ def tell(self): @GlobalStorageAccountPreparer() def test_retry_put_block_with_seekable_stream(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, retry_policy=self.retry) self._setup(bsc) blob_name = self.get_resource_name('blob') @@ -91,7 +91,7 @@ def test_retry_put_block_with_seekable_stream(self, resource_group, location, st def test_retry_put_block_with_non_seekable_stream(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, retry_policy=self.retry) self._setup(bsc) blob_name = self.get_resource_name('blob') @@ -125,7 +125,7 @@ def test_retry_put_block_with_non_seekable_stream(self, resource_group, location def test_retry_put_block_with_non_seekable_stream_fail(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, retry_policy=self.retry) self._setup(bsc) blob_name = self.get_resource_name('blob') diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_retry_async.py b/sdk/storage/azure-storage-blob/tests/test_blob_retry_async.py index 26d934db3fab..9197c46a8d2d 100644 --- a/sdk/storage/azure-storage-blob/tests/test_blob_retry_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_blob_retry_async.py @@ -73,7 +73,7 @@ async def test_retry_put_block_with_seekable_stream_async(self, resource_group, pytest.skip("Aiohttp closes stream after request - cannot rewind.") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, retry_policy=self.retry, transport=AiohttpTestTransport()) await self._setup(bsc) blob_name = self.get_resource_name('blob') @@ -107,7 +107,7 @@ async def test_retry_put_block_with_seekable_stream_async(self, resource_group, async def test_retry_put_block_with_non_seekable_stream_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, retry_policy=self.retry, transport=AiohttpTestTransport()) await self._setup(bsc) blob_name = self.get_resource_name('blob') @@ -142,7 +142,7 @@ async def test_retry_put_block_with_non_seekable_stream_async(self, resource_gro async def test_retry_put_block_with_non_seekable_stream_fail_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, retry_policy=self.retry, transport=AiohttpTestTransport()) await self._setup(bsc) blob_name = self.get_resource_name('blob') diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_service_properties.py b/sdk/storage/azure-storage-blob/tests/test_blob_service_properties.py index fb2c17f1e1eb..34001b87f943 100644 --- a/sdk/storage/azure-storage-blob/tests/test_blob_service_properties.py +++ b/sdk/storage/azure-storage-blob/tests/test_blob_service_properties.py @@ -108,7 +108,7 @@ def _assert_retention_equal(self, ret1, ret2): @GlobalStorageAccountPreparer() def test_blob_service_properties(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key) # Act resp = bsc.set_service_properties( analytics_logging=BlobAnalyticsLogging(), @@ -128,7 +128,7 @@ def test_blob_service_properties(self, resource_group, location, storage_account @GlobalStorageAccountPreparer() def test_set_default_service_version(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key) # Act bsc.set_service_properties(target_version='2014-02-14') @@ -138,7 +138,7 @@ def test_set_default_service_version(self, resource_group, location, storage_acc @GlobalStorageAccountPreparer() def test_set_delete_retention_policy(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key) delete_retention_policy = RetentionPolicy(enabled=True, days=2) # Act @@ -150,7 +150,7 @@ def test_set_delete_retention_policy(self, resource_group, location, storage_acc @GlobalStorageAccountPreparer() def test_set_delete_retention_policy_edge_cases(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key) delete_retention_policy = RetentionPolicy(enabled=True, days=1) bsc.set_service_properties(delete_retention_policy=delete_retention_policy) @@ -188,7 +188,7 @@ def test_set_delete_retention_policy_edge_cases(self, resource_group, location, @GlobalStorageAccountPreparer() def test_set_disabled_delete_retention_policy(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key) delete_retention_policy = RetentionPolicy(enabled=False) # Act @@ -200,7 +200,7 @@ def test_set_disabled_delete_retention_policy(self, resource_group, location, st @GlobalStorageAccountPreparer() def test_set_static_website_properties(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key) static_website = StaticWebsite( enabled=True, index_document="index.html", @@ -215,7 +215,7 @@ def test_set_static_website_properties(self, resource_group, location, storage_a @GlobalStorageAccountPreparer() def test_set_static_website_properties_missing_field(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key) # Case1: Arrange both missing static_website = StaticWebsite(enabled=True) @@ -249,7 +249,7 @@ def test_set_static_website_properties_missing_field(self, resource_group, locat @GlobalStorageAccountPreparer() def test_disabled_static_website_properties(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key) static_website = StaticWebsite(enabled=False, index_document="index.html", error_document404_path="errors/error/404error.html") @@ -262,7 +262,7 @@ def test_disabled_static_website_properties(self, resource_group, location, stor @GlobalStorageAccountPreparer() def test_set_static_website_props_dont_impact_other_props(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key) cors_rule1 = CorsRule(['www.xyz.com'], ['GET']) allowed_origins = ['www.xyz.com', "www.ab.com", "www.bc.com"] @@ -300,7 +300,7 @@ def test_set_static_website_props_dont_impact_other_props(self, resource_group, @GlobalStorageAccountPreparer() def test_set_logging(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key) logging = BlobAnalyticsLogging(read=True, write=True, delete=True, retention_policy=RetentionPolicy(enabled=True, days=5)) # Act @@ -312,7 +312,7 @@ def test_set_logging(self, resource_group, location, storage_account, storage_ac @GlobalStorageAccountPreparer() def test_set_hour_metrics(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key) hour_metrics = Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=5)) # Act @@ -324,7 +324,7 @@ def test_set_hour_metrics(self, resource_group, location, storage_account, stora @GlobalStorageAccountPreparer() def test_set_minute_metrics(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key) minute_metrics = Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=5)) @@ -337,7 +337,7 @@ def test_set_minute_metrics(self, resource_group, location, storage_account, sto @GlobalStorageAccountPreparer() def test_set_cors(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key) cors_rule1 = CorsRule(['www.xyz.com'], ['GET']) allowed_origins = ['www.xyz.com', "www.ab.com", "www.bc.com"] @@ -364,14 +364,14 @@ def test_set_cors(self, resource_group, location, storage_account, storage_accou # --Test cases for errors --------------------------------------- @GlobalStorageAccountPreparer() def test_retention_no_days(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key) self.assertRaises(ValueError, RetentionPolicy, True, None) @GlobalStorageAccountPreparer() def test_too_many_cors_rules(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key) cors = [] for i in range(0, 6): cors.append(CorsRule(['www.xyz.com'], ['GET'])) @@ -382,7 +382,7 @@ def test_too_many_cors_rules(self, resource_group, location, storage_account, st @GlobalStorageAccountPreparer() def test_retention_too_long(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key) minute_metrics = Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=366)) diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_service_properties_async.py b/sdk/storage/azure-storage-blob/tests/test_blob_service_properties_async.py index 7bd7cd5500e0..47a7b6ac6919 100644 --- a/sdk/storage/azure-storage-blob/tests/test_blob_service_properties_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_blob_service_properties_async.py @@ -123,7 +123,7 @@ def _assert_retention_equal(self, ret1, ret2): @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_blob_service_properties(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) # Act resp = await bsc.set_service_properties( @@ -144,7 +144,7 @@ async def test_blob_service_properties(self, resource_group, location, storage_a @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_default_service_version(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) # Act await bsc.set_service_properties(target_version='2014-02-14') @@ -156,7 +156,7 @@ async def test_set_default_service_version(self, resource_group, location, stora @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_delete_retention_policy(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) delete_retention_policy = RetentionPolicy(enabled=True, days=2) # Act @@ -170,7 +170,7 @@ async def test_set_delete_retention_policy(self, resource_group, location, stora @AsyncStorageTestCase.await_prepared_test async def test_set_delete_retention_policy_edge_cases(self, resource_group, location, storage_account, storage_account_key): # Should work with minimum settings - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) delete_retention_policy = RetentionPolicy(enabled=True, days=1) await bsc.set_service_properties(delete_retention_policy=delete_retention_policy) @@ -210,7 +210,7 @@ async def test_set_delete_retention_policy_edge_cases(self, resource_group, loca @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_disabled_delete_retention_policy(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) delete_retention_policy = RetentionPolicy(enabled=False) # Act @@ -223,7 +223,7 @@ async def test_set_disabled_delete_retention_policy(self, resource_group, locati @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_static_website_properties(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) static_website = StaticWebsite( enabled=True, index_document="index.html", @@ -240,7 +240,7 @@ async def test_set_static_website_properties(self, resource_group, location, sto @AsyncStorageTestCase.await_prepared_test async def test_set_static_web_props_missing_field(self, resource_group, location, storage_account, storage_account_key): # Case1: Arrange both missing - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) static_website = StaticWebsite(enabled=True) @@ -274,7 +274,7 @@ async def test_set_static_web_props_missing_field(self, resource_group, location @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_disabled_static_website_properties(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) static_website = StaticWebsite(enabled=False, index_document="index.html", error_document404_path="errors/error/404error.html") @@ -288,7 +288,7 @@ async def test_disabled_static_website_properties(self, resource_group, location @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_static_webprops_no_impact_other_props(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) cors_rule1 = CorsRule(['www.xyz.com'], ['GET']) allowed_origins = ['www.xyz.com', "www.ab.com", "www.bc.com"] @@ -312,7 +312,7 @@ async def test_set_static_webprops_no_impact_other_props(self, resource_group, l received_props = await bsc.get_service_properties() self._assert_cors_equal(received_props['cors'], cors) - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) static_website = StaticWebsite(enabled=True, index_document="index.html", error_document404_path="errors/error/404error.html") @@ -327,7 +327,7 @@ async def test_set_static_webprops_no_impact_other_props(self, resource_group, l @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_logging(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) logging = BlobAnalyticsLogging(read=True, write=True, delete=True, retention_policy=RetentionPolicy(enabled=True, days=5)) # Act @@ -340,7 +340,7 @@ async def test_set_logging(self, resource_group, location, storage_account, stor @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_hour_metrics(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) hour_metrics = Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=5)) # Act @@ -353,7 +353,7 @@ async def test_set_hour_metrics(self, resource_group, location, storage_account, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_minute_metrics(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) minute_metrics = Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=5)) @@ -367,7 +367,7 @@ async def test_set_minute_metrics(self, resource_group, location, storage_accoun @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_cors(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) cors_rule1 = CorsRule(['www.xyz.com'], ['GET']) allowed_origins = ['www.xyz.com', "www.ab.com", "www.bc.com"] @@ -402,7 +402,7 @@ async def test_retention_no_days(self, resource_group, location, storage_account @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_too_many_cors_rules(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) cors = [] for i in range(0, 6): cors.append(CorsRule(['www.xyz.com'], ['GET'])) @@ -414,7 +414,7 @@ async def test_too_many_cors_rules(self, resource_group, location, storage_accou @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_retention_too_long(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) minute_metrics = Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=366)) diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_service_stats.py b/sdk/storage/azure-storage-blob/tests/test_blob_service_stats.py index 1ee120ba196c..2759a019cbec 100644 --- a/sdk/storage/azure-storage-blob/tests/test_blob_service_stats.py +++ b/sdk/storage/azure-storage-blob/tests/test_blob_service_stats.py @@ -49,7 +49,7 @@ def override_response_body_with_unavailable_status(response): @StorageAccountPreparer(random_name_enabled=True, name_prefix='pyacrstorage', sku='Standard_RAGRS') def test_blob_service_stats(self, resource_group, location, storage_account, storage_account_key): # Arrange - url = self.account_url(storage_account.name, "blob") + url = self.account_url(storage_account, "blob") bs = BlobServiceClient(url, credential=storage_account_key) # Act stats = bs.get_service_stats(raw_response_hook=self.override_response_body_with_live_status) @@ -61,7 +61,7 @@ def test_blob_service_stats(self, resource_group, location, storage_account, sto @StorageAccountPreparer(random_name_enabled=True, name_prefix='pyacrstorage', sku='Standard_RAGRS') def test_blob_service_stats_when_unavailable(self, resource_group, location, storage_account, storage_account_key): # Arrange - url = self.account_url(storage_account.name, "blob") + url = self.account_url(storage_account, "blob") bs = BlobServiceClient(url, credential=storage_account_key) # Act diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_service_stats_async.py b/sdk/storage/azure-storage-blob/tests/test_blob_service_stats_async.py index c7dd47f77342..e44ea0e5bf1a 100644 --- a/sdk/storage/azure-storage-blob/tests/test_blob_service_stats_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_blob_service_stats_async.py @@ -67,7 +67,7 @@ def override_response_body_with_unavailable_status(response): @AsyncStorageTestCase.await_prepared_test async def test_blob_service_stats_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - bs = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) + bs = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) # Act stats = await bs.get_service_stats(raw_response_hook=self.override_response_body_with_live_status) @@ -79,7 +79,7 @@ async def test_blob_service_stats_async(self, resource_group, location, storage_ @AsyncStorageTestCase.await_prepared_test async def test_blob_service_stats_when_unavailable_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - bs = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) + bs = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) # Act stats = await bs.get_service_stats(raw_response_hook=self.override_response_body_with_unavailable_status) diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_storage_account.py b/sdk/storage/azure-storage-blob/tests/test_blob_storage_account.py index d65f971350a6..7c67b2e9af58 100644 --- a/sdk/storage/azure-storage-blob/tests/test_blob_storage_account.py +++ b/sdk/storage/azure-storage-blob/tests/test_blob_storage_account.py @@ -53,7 +53,7 @@ def assertBlobEqual(self, container_name, blob_name, expected_data, bsc): @GlobalStorageAccountPreparer() def test_standard_blob_tier_set_tier_api(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key) self._setup(bsc) container = bsc.get_container_client(self.container_name) tiers = [StandardBlobTier.Archive, StandardBlobTier.Cool, StandardBlobTier.Hot] @@ -102,7 +102,7 @@ def test_standard_blob_tier_set_tier_api(self, resource_group, location, storage @GlobalStorageAccountPreparer() def test_set_standard_blob_tier_with_rehydrate_priority(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key) self._setup(bsc) blob_client = self._create_blob(bsc) blob_tier = StandardBlobTier.Archive @@ -120,7 +120,7 @@ def test_set_standard_blob_tier_with_rehydrate_priority(self, resource_group, lo @GlobalStorageAccountPreparer() def test_rehydration_status(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key) self._setup(bsc) blob_name = 'rehydration_test_blob_1' blob_name2 = 'rehydration_test_blob_2' diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_storage_account_async.py b/sdk/storage/azure-storage-blob/tests/test_blob_storage_account_async.py index 73a4c5220628..76c6f9e2f1ca 100644 --- a/sdk/storage/azure-storage-blob/tests/test_blob_storage_account_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_blob_storage_account_async.py @@ -71,7 +71,7 @@ async def assertBlobEqual(self, container_name, blob_name, expected_data, bsc): @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_standard_blob_tier_set_tier_api(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) await self._setup(bsc) container = bsc.get_container_client(self.container_name) @@ -126,7 +126,7 @@ async def test_standard_blob_tier_set_tier_api(self, resource_group, location, s @AsyncStorageTestCase.await_prepared_test async def test_set_std_blob_tier_w_rehydrate_priority(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) await self._setup(bsc) blob_client = await self._create_blob(bsc) blob_tier = StandardBlobTier.Archive @@ -145,7 +145,7 @@ async def test_set_std_blob_tier_w_rehydrate_priority(self, resource_group, loca @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_rehydration_status(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, transport=AiohttpTestTransport()) await self._setup(bsc) blob_name = 'rehydration_test_blob_1' blob_name2 = 'rehydration_test_blob_2' diff --git a/sdk/storage/azure-storage-blob/tests/test_block_blob.py b/sdk/storage/azure-storage-blob/tests/test_block_blob.py index 903ac11afe3f..736f4f30a091 100644 --- a/sdk/storage/azure-storage-blob/tests/test_block_blob.py +++ b/sdk/storage/azure-storage-blob/tests/test_block_blob.py @@ -31,11 +31,11 @@ class StorageBlockBlobTest(StorageTestCase): - def _setup(self, name, key): + def _setup(self, storage_account, key): # test chunking functionality by reducing the size of each chunk, # otherwise the tests would take too long to execute self.bsc = BlobServiceClient( - self.account_url(name, "blob"), + self.account_url(storage_account, "blob"), credential=key, connection_data_block_size=4 * 1024, max_single_put_size=32 * 1024, @@ -82,7 +82,7 @@ def read(self, count): @GlobalStorageAccountPreparer() def test_put_block(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob = self._create_blob() # Act @@ -94,7 +94,7 @@ def test_put_block(self, resource_group, location, storage_account, storage_acco @GlobalStorageAccountPreparer() def test_put_block_unicode(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob = self._create_blob() # Act @@ -105,7 +105,7 @@ def test_put_block_unicode(self, resource_group, location, storage_account, stor @GlobalStorageAccountPreparer() def test_put_block_with_md5(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob = self._create_blob() # Act @@ -115,7 +115,7 @@ def test_put_block_with_md5(self, resource_group, location, storage_account, sto @GlobalStorageAccountPreparer() def test_put_block_list(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) blob.stage_block('1', b'AAA') @@ -134,7 +134,7 @@ def test_put_block_list(self, resource_group, location, storage_account, storage @GlobalStorageAccountPreparer() def test_put_block_list_invalid_block_id(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) blob.stage_block('1', b'AAA') @@ -153,7 +153,7 @@ def test_put_block_list_invalid_block_id(self, resource_group, location, storage @GlobalStorageAccountPreparer() def test_put_block_list_with_md5(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) blob.stage_block('1', b'AAA') @@ -170,7 +170,7 @@ def test_put_block_list_with_md5(self, resource_group, location, storage_account def test_put_block_list_with_blob_tier_specified(self, resource_group, location, storage_account, storage_account_key): # Arrange - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob_client = self.bsc.get_blob_client(self.container_name, blob_name) blob_client.stage_block('1', b'AAA') @@ -189,7 +189,7 @@ def test_put_block_list_with_blob_tier_specified(self, resource_group, location, @GlobalStorageAccountPreparer() def test_get_block_list_no_blocks(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob = self._create_blob() # Act @@ -202,7 +202,7 @@ def test_get_block_list_no_blocks(self, resource_group, location, storage_accoun @GlobalStorageAccountPreparer() def test_get_block_list_uncommitted_blocks(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) blob.stage_block('1', b'AAA') @@ -226,7 +226,7 @@ def test_get_block_list_uncommitted_blocks(self, resource_group, location, stora @GlobalStorageAccountPreparer() def test_get_block_list_committed_blocks(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) blob.stage_block('1', b'AAA') @@ -253,7 +253,7 @@ def test_get_block_list_committed_blocks(self, resource_group, location, storage @GlobalStorageAccountPreparer() def test_create_small_block_blob_with_no_overwrite(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data1 = b'hello world' @@ -275,7 +275,7 @@ def test_create_small_block_blob_with_no_overwrite(self, resource_group, locatio @GlobalStorageAccountPreparer() def test_create_small_block_blob_with_overwrite(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data1 = b'hello world' @@ -295,7 +295,7 @@ def test_create_small_block_blob_with_overwrite(self, resource_group, location, @GlobalStorageAccountPreparer() def test_create_large_block_blob_with_no_overwrite(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data1 = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -319,7 +319,7 @@ def test_create_large_block_blob_with_no_overwrite(self, resource_group, locatio @GlobalStorageAccountPreparer() def test_create_large_block_blob_with_overwrite(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data1 = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -341,7 +341,7 @@ def test_create_large_block_blob_with_overwrite(self, resource_group, location, @GlobalStorageAccountPreparer() def test_create_blob_from_bytes_single_put(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = b'hello world' @@ -357,7 +357,7 @@ def test_create_blob_from_bytes_single_put(self, resource_group, location, stora @GlobalStorageAccountPreparer() def test_create_blob_from_0_bytes(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = b'' @@ -373,7 +373,7 @@ def test_create_blob_from_0_bytes(self, resource_group, location, storage_accoun @GlobalStorageAccountPreparer() def test_create_from_bytes_blob_unicode(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = u'hello world' @@ -389,7 +389,7 @@ def test_create_from_bytes_blob_unicode(self, resource_group, location, storage_ @GlobalStorageAccountPreparer() def test_create_from_bytes_blob_unicode(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -408,7 +408,7 @@ def test_create_from_bytes_blob_unicode(self, resource_group, location, storage_ def test_create_from_bytes_blob_with_lease_id(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob = self._create_blob() data = self.get_random_bytes(LARGE_BLOB_SIZE) lease = blob.acquire_lease() @@ -427,7 +427,7 @@ def test_create_from_bytes_blob_with_lease_id(self, resource_group, location, st def test_create_blob_from_bytes_with_metadata(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -445,7 +445,7 @@ def test_create_blob_from_bytes_with_metadata(self, resource_group, location, st def test_create_blob_from_bytes_with_properties(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -467,7 +467,7 @@ def test_create_blob_from_bytes_with_properties(self, resource_group, location, def test_create_blob_from_bytes_with_progress(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -494,7 +494,7 @@ def callback(response): def test_create_blob_from_bytes_with_index(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -507,7 +507,7 @@ def test_create_blob_from_bytes_with_index(self, resource_group, location, stora @GlobalStorageAccountPreparer() def test_create_blob_from_bytes_with_index_and_count(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -520,7 +520,7 @@ def test_create_blob_from_bytes_with_index_and_count(self, resource_group, locat @GlobalStorageAccountPreparer() def test_create_blob_from_bytes_with_index_and_count_and_properties(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -539,7 +539,7 @@ def test_create_blob_from_bytes_with_index_and_count_and_properties(self, resour @GlobalStorageAccountPreparer() def test_create_blob_from_bytes_non_parallel(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -553,7 +553,7 @@ def test_create_blob_from_bytes_non_parallel(self, resource_group, location, sto @GlobalStorageAccountPreparer() def test_create_blob_from_bytes_with_blob_tier_specified(self, resource_group, location, storage_account, storage_account_key): # Arrange - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob_client = self.bsc.get_blob_client(self.container_name, blob_name) data = b'hello world' @@ -571,7 +571,7 @@ def test_create_blob_from_bytes_with_blob_tier_specified(self, resource_group, l def test_create_blob_from_path(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -592,7 +592,7 @@ def test_create_blob_from_path(self, resource_group, location, storage_account, @GlobalStorageAccountPreparer() def test_create_blob_from_path_non_parallel(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(100) @@ -614,7 +614,7 @@ def test_create_blob_from_path_non_parallel(self, resource_group, location, stor @GlobalStorageAccountPreparer() def test_upload_blob_from_path_non_parallel_with_standard_blob_tier(self, resource_group, location, storage_account, storage_account_key): # Arrange - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(100) @@ -636,7 +636,7 @@ def test_upload_blob_from_path_non_parallel_with_standard_blob_tier(self, resour def test_create_blob_from_path_with_progress(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -665,7 +665,7 @@ def callback(response): def test_create_blob_from_path_with_properties(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -692,7 +692,7 @@ def test_create_blob_from_path_with_properties(self, resource_group, location, s def test_create_blob_from_stream_chunked_upload(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -716,7 +716,7 @@ def test_create_blob_from_stream_chunked_upload(self, resource_group, location, def test_create_frm_stream_nonseek_chunk_upld_knwn_size(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -739,7 +739,7 @@ def test_create_frm_stream_nonseek_chunk_upld_knwn_size(self, resource_group, lo def test_create_from_stream_nonseek_chunk_upld_unkwn_size(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -761,7 +761,7 @@ def test_create_from_stream_nonseek_chunk_upld_unkwn_size(self, resource_group, def test_create_blob_from_stream_with_progress_chunked_upload(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -790,7 +790,7 @@ def callback(response): def test_create_blob_from_stream_chunked_upload_with_count(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -812,7 +812,7 @@ def test_create_blob_from_stream_chunked_upload_with_count(self, resource_group, def test_create_from_stream_chunk_upload_with_cntandrops(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -840,7 +840,7 @@ def test_create_from_stream_chunk_upload_with_cntandrops(self, resource_group, l def test_create_blob_from_stream_chnked_upload_with_properties(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -868,7 +868,7 @@ def test_create_blob_from_stream_chunked_upload_with_properties(self, resource_g # parallel tests introduce random order of requests, can only run live # Arrange - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -892,7 +892,7 @@ def test_create_blob_from_stream_chunked_upload_with_properties(self, resource_g @GlobalStorageAccountPreparer() def test_create_blob_from_text(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) text = u'hello 啊齄丂狛狜 world' @@ -909,7 +909,7 @@ def test_create_blob_from_text(self, resource_group, location, storage_account, @GlobalStorageAccountPreparer() def test_create_blob_from_text_with_encoding(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) text = u'hello 啊齄丂狛狜 world' @@ -923,7 +923,7 @@ def test_create_blob_from_text_with_encoding(self, resource_group, location, sto @GlobalStorageAccountPreparer() def test_create_blob_from_text_with_encoding_and_progress(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) text = u'hello 啊齄丂狛狜 world' @@ -948,7 +948,7 @@ def callback(response): def test_create_blob_from_text_chunked_upload(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_text_data(LARGE_BLOB_SIZE) @@ -965,7 +965,7 @@ def test_create_blob_from_text_chunked_upload(self, resource_group, location, st @GlobalStorageAccountPreparer() def test_create_blob_with_md5(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = b'hello world' @@ -980,7 +980,7 @@ def test_create_blob_with_md5(self, resource_group, location, storage_account, s def test_create_blob_with_md5_chunked(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) diff --git a/sdk/storage/azure-storage-blob/tests/test_block_blob_async.py b/sdk/storage/azure-storage-blob/tests/test_block_blob_async.py index a0b16c0cfe84..8619bd65504f 100644 --- a/sdk/storage/azure-storage-blob/tests/test_block_blob_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_block_blob_async.py @@ -49,11 +49,11 @@ async def send(self, request, **config): class StorageBlockBlobTestAsync(AsyncStorageTestCase): #--Helpers----------------------------------------------------------------- - async def _setup(self, name, key): + async def _setup(self, storage_account, key): # test chunking functionality by reducing the size of each chunk, # otherwise the tests would take too long to execute self.bsc = BlobServiceClient( - self.account_url(name, "blob"), + self.account_url(storage_account, "blob"), credential=key, connection_data_block_size=4 * 1024, max_single_put_size=32 * 1024, @@ -78,14 +78,12 @@ def _get_blob_reference(self): return self.get_resource_name(TEST_BLOB_PREFIX) async def _create_blob(self): - #await self._setup(storage_account.name, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) await blob.upload_blob(b'') return blob async def assertBlobEqual(self, container_name, blob_name, expected_data): - #await self._setup(storage_account.name, storage_account_key) blob = self.bsc.get_blob_client(container_name, blob_name) stream = await blob.download_blob() actual_data = await stream.readall() @@ -106,7 +104,7 @@ def read(self, count): @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_put_block(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) # Arrange blob = await self._create_blob() @@ -119,7 +117,7 @@ async def test_put_block(self, resource_group, location, storage_account, storag @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_put_block_unicode(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) # Arrange blob = await self._create_blob() @@ -133,7 +131,7 @@ async def test_put_block_unicode(self, resource_group, location, storage_account @AsyncStorageTestCase.await_prepared_test async def test_put_block_with_md5(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob = await self._create_blob() # Act @@ -145,7 +143,7 @@ async def test_put_block_with_md5(self, resource_group, location, storage_accoun @AsyncStorageTestCase.await_prepared_test async def test_put_block_list(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) await blob.stage_block('1', b'AAA') @@ -167,7 +165,7 @@ async def test_put_block_list(self, resource_group, location, storage_account, s @AsyncStorageTestCase.await_prepared_test async def test_put_block_list_invalid_block_id(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) await blob.stage_block('1', b'AAA') @@ -188,7 +186,7 @@ async def test_put_block_list_invalid_block_id(self, resource_group, location, s @AsyncStorageTestCase.await_prepared_test async def test_put_block_list_with_md5(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) await blob.stage_block('1', b'AAA') @@ -204,7 +202,7 @@ async def test_put_block_list_with_md5(self, resource_group, location, storage_a @AsyncStorageTestCase.await_prepared_test async def _test_put_block_list_with_blob_tier_specified(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob_client = self.bsc.get_blob_client(self.container_name, blob_name) await blob_client.stage_block('1', b'AAA') @@ -225,7 +223,7 @@ async def _test_put_block_list_with_blob_tier_specified(self, resource_group, lo @AsyncStorageTestCase.await_prepared_test async def test_get_block_list_no_blocks(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob = await self._create_blob() # Act @@ -241,7 +239,7 @@ async def test_get_block_list_no_blocks(self, resource_group, location, storage_ @AsyncStorageTestCase.await_prepared_test async def test_get_block_list_uncommitted_blocks(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) await blob.stage_block('1', b'AAA') @@ -268,7 +266,7 @@ async def test_get_block_list_uncommitted_blocks(self, resource_group, location, @AsyncStorageTestCase.await_prepared_test async def test_get_block_list_committed_blocks(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) await blob.stage_block('1', b'AAA') @@ -298,7 +296,7 @@ async def test_get_block_list_committed_blocks(self, resource_group, location, s @AsyncStorageTestCase.await_prepared_test async def test_create_small_block_blob_with_no_overwrite(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data1 = b'hello world' @@ -322,7 +320,7 @@ async def test_create_small_block_blob_with_no_overwrite(self, resource_group, l @AsyncStorageTestCase.await_prepared_test async def test_create_small_block_blob_with_overwrite(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data1 = b'hello world' @@ -344,7 +342,7 @@ async def test_create_small_block_blob_with_overwrite(self, resource_group, loca @AsyncStorageTestCase.await_prepared_test async def test_create_large_block_blob_with_no_overwrite(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data1 = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -370,7 +368,7 @@ async def test_create_large_block_blob_with_no_overwrite(self, resource_group, l @AsyncStorageTestCase.await_prepared_test async def test_create_large_block_blob_with_overwrite(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data1 = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -394,7 +392,7 @@ async def test_create_large_block_blob_with_overwrite(self, resource_group, loca @AsyncStorageTestCase.await_prepared_test async def test_create_blob_from_bytes_single_put(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = b'hello world' @@ -412,7 +410,7 @@ async def test_create_blob_from_bytes_single_put(self, resource_group, location, @AsyncStorageTestCase.await_prepared_test async def test_create_blob_from_0_bytes(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = b'' @@ -430,7 +428,7 @@ async def test_create_blob_from_0_bytes(self, resource_group, location, storage_ @AsyncStorageTestCase.await_prepared_test async def test_create_from_bytes_blob_unicode(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = b'hello world' @@ -449,7 +447,7 @@ async def test_create_from_bytes_blob_unicode(self, resource_group, location, st @AsyncStorageTestCase.await_prepared_test async def test_create_from_bytes_blob_with_lease_id(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) # Arrange blob = await self._create_blob() @@ -471,7 +469,7 @@ async def test_create_from_bytes_blob_with_lease_id(self, resource_group, locati @AsyncStorageTestCase.await_prepared_test async def test_create_blob_from_bytes_with_metadata(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) # Arrange blob_name = self._get_blob_reference() @@ -492,7 +490,7 @@ async def test_create_blob_from_bytes_with_metadata(self, resource_group, locati @AsyncStorageTestCase.await_prepared_test async def test_create_blob_from_bytes_with_properties(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) # Arrange blob_name = self._get_blob_reference() @@ -516,7 +514,7 @@ async def test_create_blob_from_bytes_with_properties(self, resource_group, loca @AsyncStorageTestCase.await_prepared_test async def test_create_blob_from_bytes_with_progress(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) # Arrange blob_name = self._get_blob_reference() @@ -545,7 +543,7 @@ def callback(response): @AsyncStorageTestCase.await_prepared_test async def test_create_blob_from_bytes_with_index(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) # Arrange blob_name = self._get_blob_reference() @@ -564,7 +562,7 @@ async def test_create_blob_from_bytes_with_index(self, resource_group, location, @AsyncStorageTestCase.await_prepared_test async def test_create_blob_from_bytes_with_index_and_count(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -581,7 +579,7 @@ async def test_create_blob_from_bytes_with_index_and_count(self, resource_group, @AsyncStorageTestCase.await_prepared_test async def test_create_frm_bytes_with_index_cnt_props(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -604,7 +602,7 @@ async def test_create_frm_bytes_with_index_cnt_props(self, resource_group, locat @AsyncStorageTestCase.await_prepared_test async def test_create_blob_from_bytes_non_parallel(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -619,7 +617,7 @@ async def test_create_blob_from_bytes_non_parallel(self, resource_group, locatio @AsyncStorageTestCase.await_prepared_test async def _test_create_blob_from_bytes_with_blob_tier_specified(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob_client = self.bsc.get_blob_client(self.container_name, blob_name) data = b'hello world' @@ -637,7 +635,7 @@ async def _test_create_blob_from_bytes_with_blob_tier_specified(self, resource_g @AsyncStorageTestCase.await_prepared_test async def test_create_blob_from_path(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) # Arrange blob_name = self._get_blob_reference() @@ -662,7 +660,7 @@ async def test_create_blob_from_path(self, resource_group, location, storage_acc @AsyncStorageTestCase.await_prepared_test async def test_create_blob_from_path_non_parallel(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(100) @@ -685,7 +683,7 @@ async def test_create_blob_from_path_non_parallel(self, resource_group, location @AsyncStorageTestCase.await_prepared_test async def _test_upload_blob_from_path_non_parallel_with_standard_blob_tier(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) FILE_PATH = 'non_parallel_with_standard_blob_tier.temp.{}.dat'.format(str(uuid.uuid4())) @@ -707,7 +705,7 @@ async def _test_upload_blob_from_path_non_parallel_with_standard_blob_tier(self, @AsyncStorageTestCase.await_prepared_test async def test_create_blob_from_path_with_progress(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) # Arrange blob_name = self._get_blob_reference() @@ -738,7 +736,7 @@ def callback(response): @AsyncStorageTestCase.await_prepared_test async def test_create_blob_from_path_with_properties(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) # Arrange blob_name = self._get_blob_reference() @@ -767,7 +765,7 @@ async def test_create_blob_from_path_with_properties(self, resource_group, locat @AsyncStorageTestCase.await_prepared_test async def test_create_blob_from_stream_chunked_upload(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) # Arrange blob_name = self._get_blob_reference() @@ -793,7 +791,7 @@ async def test_create_blob_from_stream_chunked_upload(self, resource_group, loca @AsyncStorageTestCase.await_prepared_test async def test_create_frm_stream_nonseek_chunk_upload_knwn_size(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) # Arrange blob_name = self._get_blob_reference() @@ -818,7 +816,7 @@ async def test_create_frm_stream_nonseek_chunk_upload_knwn_size(self, resource_g @AsyncStorageTestCase.await_prepared_test async def test_blob_frm_strm_nonseek_chunk_upld_unkwn_size(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) # Arrange blob_name = self._get_blob_reference() @@ -842,7 +840,7 @@ async def test_blob_frm_strm_nonseek_chunk_upld_unkwn_size(self, resource_group, @AsyncStorageTestCase.await_prepared_test async def test_create_blob_from_stream_with_progress_chunked_upload(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) # Arrange blob_name = self._get_blob_reference() @@ -873,7 +871,7 @@ def callback(response): @AsyncStorageTestCase.await_prepared_test async def test_create_blob_from_stream_chunked_upload_with_count(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) # Arrange blob_name = self._get_blob_reference() @@ -897,7 +895,7 @@ async def test_create_blob_from_stream_chunked_upload_with_count(self, resource_ @AsyncStorageTestCase.await_prepared_test async def test_create_frm_stream_chu_upld_with_countandprops(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) # Arrange blob_name = self._get_blob_reference() @@ -928,7 +926,7 @@ async def test_create_frm_stream_chu_upld_with_countandprops(self, resource_grou async def test_create_blob_from_stream_chunked_upload_with_properties(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) # Arrange blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -958,7 +956,7 @@ async def _test_create_blob_from_stream_chunked_upload_with_properties(self, res # parallel tests introduce random order of requests, can only run live # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -985,7 +983,7 @@ async def _test_create_blob_from_stream_chunked_upload_with_properties(self, res @AsyncStorageTestCase.await_prepared_test async def test_create_blob_from_text(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) text = u'hello 啊齄丂狛狜 world' @@ -1004,7 +1002,7 @@ async def test_create_blob_from_text(self, resource_group, location, storage_acc @AsyncStorageTestCase.await_prepared_test async def test_create_blob_from_text_with_encoding(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) text = u'hello 啊齄丂狛狜 world' @@ -1020,7 +1018,7 @@ async def test_create_blob_from_text_with_encoding(self, resource_group, locatio @AsyncStorageTestCase.await_prepared_test async def test_create_blob_from_text_with_encoding_and_progress(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) text = u'hello 啊齄丂狛狜 world' @@ -1045,7 +1043,7 @@ def callback(response): @AsyncStorageTestCase.await_prepared_test async def test_create_blob_from_text_chunked_upload(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) # Arrange blob_name = self._get_blob_reference() @@ -1066,7 +1064,7 @@ async def test_create_blob_from_text_chunked_upload(self, resource_group, locati @AsyncStorageTestCase.await_prepared_test async def test_create_blob_with_md5(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = b'hello world' @@ -1083,7 +1081,7 @@ async def test_create_blob_with_md5_chunked(self, resource_group, location, stor # parallel tests introduce random order of requests, can only run live # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) diff --git a/sdk/storage/azure-storage-blob/tests/test_block_blob_sync_copy.py b/sdk/storage/azure-storage-blob/tests/test_block_blob_sync_copy.py index be0efa951fb7..327d27e00278 100644 --- a/sdk/storage/azure-storage-blob/tests/test_block_blob_sync_copy.py +++ b/sdk/storage/azure-storage-blob/tests/test_block_blob_sync_copy.py @@ -28,9 +28,9 @@ class StorageBlockBlobTest(StorageTestCase): - def _setup(self, name, key): + def _setup(self, storage_account, key): self.bsc = BlobServiceClient( - self.account_url(name, "blob"), + self.account_url(storage_account, "blob"), credential=key, connection_data_block_size=4 * 1024, max_single_put_size=32 * 1024, @@ -61,7 +61,7 @@ def _setup(self, name, key): @GlobalStorageAccountPreparer() def test_put_block_from_url_and_commit(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) dest_blob_name = self.get_resource_name('destblob') dest_blob = self.bsc.get_blob_client(self.container_name, dest_blob_name) @@ -93,7 +93,7 @@ def test_put_block_from_url_and_commit(self, resource_group, location, storage_a @GlobalStorageAccountPreparer() def test_put_block_from_url_and_validate_content_md5(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) dest_blob_name = self.get_resource_name('destblob') dest_blob = self.bsc.get_blob_client(self.container_name, dest_blob_name) src_md5 = StorageContentValidation.get_content_md5(self.source_blob_data) @@ -129,7 +129,7 @@ def test_put_block_from_url_and_validate_content_md5(self, resource_group, locat @GlobalStorageAccountPreparer() def test_copy_blob_sync(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) dest_blob_name = self.get_resource_name('destblob') dest_blob = self.bsc.get_blob_client(self.container_name, dest_blob_name) diff --git a/sdk/storage/azure-storage-blob/tests/test_block_blob_sync_copy_async.py b/sdk/storage/azure-storage-blob/tests/test_block_blob_sync_copy_async.py index 8ffa16b0e57c..e434d01bb829 100644 --- a/sdk/storage/azure-storage-blob/tests/test_block_blob_sync_copy_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_block_blob_sync_copy_async.py @@ -42,11 +42,11 @@ async def send(self, request, **config): class StorageBlockBlobTestAsync(AsyncStorageTestCase): - async def _setup(self, name, key): + async def _setup(self, storage_account, key): # test chunking functionality by reducing the size of each chunk, # otherwise the tests would take too long to execute self.bsc = BlobServiceClient( - self.account_url(name, "blob"), + self.account_url(storage_account, "blob"), credential=key, connection_data_block_size=4 * 1024, max_single_put_size=32 * 1024, @@ -84,7 +84,7 @@ async def _setup(self, name, key): @AsyncStorageTestCase.await_prepared_test async def test_put_block_from_url_and_commit_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) dest_blob_name = self.get_resource_name('destblob') dest_blob = self.bsc.get_blob_client(self.container_name, dest_blob_name) @@ -120,7 +120,7 @@ async def test_put_block_from_url_and_commit_async(self, resource_group, locatio @AsyncStorageTestCase.await_prepared_test async def test_put_block_from_url_and_vldte_content_md5(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) dest_blob_name = self.get_resource_name('destblob') dest_blob = self.bsc.get_blob_client(self.container_name, dest_blob_name) src_md5 = StorageContentValidation.get_content_md5(self.source_blob_data) @@ -158,7 +158,7 @@ async def test_put_block_from_url_and_vldte_content_md5(self, resource_group, lo @AsyncStorageTestCase.await_prepared_test async def test_copy_blob_sync_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) dest_blob_name = self.get_resource_name('destblob') dest_blob = self.bsc.get_blob_client(self.container_name, dest_blob_name) 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 e99be1d94238..5c4cc0f8d959 100644 --- a/sdk/storage/azure-storage-blob/tests/test_common_blob.py +++ b/sdk/storage/azure-storage-blob/tests/test_common_blob.py @@ -52,8 +52,8 @@ class StorageCommonBlobTest(StorageTestCase): - def _setup(self, name, key): - self.bsc = BlobServiceClient(self.account_url(name, "blob"), credential=key) + def _setup(self, storage_account, key): + self.bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=key) self.container_name = self.get_resource_name('utcontainer') if self.is_live: container = self.bsc.get_container_client(self.container_name) @@ -63,8 +63,8 @@ def _setup(self, name, key): pass self.byte_data = self.get_random_bytes(1024) - def _setup_remote(self, name, key): - self.bsc2 = BlobServiceClient(self.account_url(name, "blob"), credential=key) + def _setup_remote(self, storage_account, key): + self.bsc2 = BlobServiceClient(self.account_url(storage_account, "blob"), credential=key) self.remote_container_name = 'rmt' def _teardown(self, FILE_PATH): @@ -139,7 +139,7 @@ def _assert_blob_not_soft_deleted(self, blob): #-- Common test cases for blobs ---------------------------------------------- @GlobalStorageAccountPreparer() def test_blob_exists(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() # Act @@ -152,7 +152,7 @@ def test_blob_exists(self, resource_group, location, storage_account, storage_ac @GlobalStorageAccountPreparer() def test_blob_not_exists(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() # Act @@ -163,7 +163,7 @@ def test_blob_not_exists(self, resource_group, location, storage_account, storag @GlobalStorageAccountPreparer() def test_blob_snapshot_exists(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) snapshot = blob.create_snapshot() @@ -178,7 +178,7 @@ def test_blob_snapshot_exists(self, resource_group, location, storage_account, s @GlobalStorageAccountPreparer() def test_blob_snapshot_not_exists(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() # Act @@ -190,7 +190,7 @@ def test_blob_snapshot_not_exists(self, resource_group, location, storage_accoun @GlobalStorageAccountPreparer() def test_blob_container_not_exists(self, resource_group, location, storage_account, storage_account_key): # In this case both the blob and container do not exist - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() # Act @@ -201,7 +201,7 @@ def test_blob_container_not_exists(self, resource_group, location, storage_accou @GlobalStorageAccountPreparer() def test_create_blob_with_question_mark(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = '?ques?tion?' blob_data = u'???' @@ -217,7 +217,7 @@ def test_create_blob_with_question_mark(self, resource_group, location, storage_ @GlobalStorageAccountPreparer() def test_create_blob_with_special_chars(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) # Act for c in '-._ /()$=\',~': @@ -234,7 +234,7 @@ def test_create_blob_with_special_chars(self, resource_group, location, storage_ @GlobalStorageAccountPreparer() def test_create_blob_with_lease_id(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) lease = blob.acquire_lease() @@ -250,7 +250,7 @@ def test_create_blob_with_lease_id(self, resource_group, location, storage_accou @GlobalStorageAccountPreparer() def test_create_blob_with_generator(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) # Act def gen(): @@ -268,7 +268,7 @@ def gen(): @pytest.mark.live_test_only @GlobalStorageAccountPreparer() def test_create_blob_with_requests(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) # Act uri = "http://www.gutenberg.org/files/59466/59466-0.txt" @@ -280,7 +280,7 @@ def test_create_blob_with_requests(self, resource_group, location, storage_accou @GlobalStorageAccountPreparer() def test_create_blob_with_metadata(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() metadata={'hello': 'world', 'number': '42'} @@ -297,7 +297,7 @@ def test_create_blob_with_metadata(self, resource_group, location, storage_accou @GlobalStorageAccountPreparer() def test_get_blob_with_existing_blob(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() # Act @@ -311,7 +311,7 @@ def test_get_blob_with_existing_blob(self, resource_group, location, storage_acc @GlobalStorageAccountPreparer() def test_get_blob_with_snapshot(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) snapshot = self.bsc.get_blob_client( @@ -327,7 +327,7 @@ def test_get_blob_with_snapshot(self, resource_group, location, storage_account, @GlobalStorageAccountPreparer() def test_get_blob_with_snapshot_previous(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) snapshot = self.bsc.get_blob_client( @@ -347,7 +347,7 @@ def test_get_blob_with_snapshot_previous(self, resource_group, location, storage @GlobalStorageAccountPreparer() def test_get_blob_with_range(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() # Act @@ -360,7 +360,7 @@ def test_get_blob_with_range(self, resource_group, location, storage_account, st @GlobalStorageAccountPreparer() def test_get_blob_with_lease(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) lease = blob.acquire_lease() @@ -375,7 +375,7 @@ def test_get_blob_with_lease(self, resource_group, location, storage_account, st @GlobalStorageAccountPreparer() def test_get_blob_with_non_existing_blob(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() # Act @@ -387,7 +387,7 @@ def test_get_blob_with_non_existing_blob(self, resource_group, location, storage @GlobalStorageAccountPreparer() def test_set_blob_properties_with_existing_blob(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() # Act @@ -406,7 +406,7 @@ def test_set_blob_properties_with_existing_blob(self, resource_group, location, @GlobalStorageAccountPreparer() def test_set_blob_properties_with_blob_settings_param(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) props = blob.get_blob_properties() @@ -424,7 +424,7 @@ def test_set_blob_properties_with_blob_settings_param(self, resource_group, loca @GlobalStorageAccountPreparer() def test_get_blob_properties(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() # Act @@ -443,7 +443,7 @@ def test_get_blob_properties(self, resource_group, location, storage_account, st # HEAD request. @GlobalStorageAccountPreparer() def test_get_blob_properties_fail(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() # Act @@ -461,7 +461,7 @@ def test_get_blob_properties_fail(self, resource_group, location, storage_accoun # GET request. This is preferred to relying on the ErrorCode in the body. @GlobalStorageAccountPreparer() def test_get_blob_metadata_fail(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() # Act @@ -475,7 +475,7 @@ def test_get_blob_metadata_fail(self, resource_group, location, storage_account, @GlobalStorageAccountPreparer() def test_get_blob_server_encryption(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() # Act @@ -488,7 +488,7 @@ def test_get_blob_server_encryption(self, resource_group, location, storage_acco @GlobalStorageAccountPreparer() def test_get_blob_properties_server_encryption(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() # Act @@ -501,7 +501,7 @@ def test_get_blob_properties_server_encryption(self, resource_group, location, s @GlobalStorageAccountPreparer() def test_list_blobs_server_encryption(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self._create_block_blob() container = self.bsc.get_container_client(self.container_name) blob_list = container.list_blobs() @@ -515,7 +515,7 @@ def test_list_blobs_server_encryption(self, resource_group, location, storage_ac @GlobalStorageAccountPreparer() def test_no_server_encryption(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -531,7 +531,7 @@ def callback(response): @GlobalStorageAccountPreparer() def test_get_blob_properties_with_snapshot(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() container = self.bsc.get_container_client(self.container_name) blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -551,7 +551,7 @@ def test_get_blob_properties_with_snapshot(self, resource_group, location, stora @GlobalStorageAccountPreparer() def test_get_blob_properties_with_leased_blob(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) lease = blob.acquire_lease() @@ -570,7 +570,7 @@ def test_get_blob_properties_with_leased_blob(self, resource_group, location, st @GlobalStorageAccountPreparer() def test_get_blob_metadata(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() # Act @@ -585,7 +585,7 @@ def test_get_blob_metadata(self, resource_group, location, storage_account, stor def test_set_blob_metadata_with_upper_case(self, resource_group, location, storage_account, storage_account_key): # bug in devtools...converts upper case header to lowercase # passes live. - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) metadata = {'hello': 'world', 'number': '42', 'UP': 'UPval'} blob_name = self._create_block_blob() @@ -604,7 +604,7 @@ def test_set_blob_metadata_with_upper_case(self, resource_group, location, stora @GlobalStorageAccountPreparer() def test_delete_blob_with_existing_blob(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() # Act @@ -617,7 +617,7 @@ def test_delete_blob_with_existing_blob(self, resource_group, location, storage_ @GlobalStorageAccountPreparer() def test_delete_blob_with_non_existing_blob(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() # Act @@ -630,7 +630,7 @@ def test_delete_blob_with_non_existing_blob(self, resource_group, location, stor @GlobalStorageAccountPreparer() def test_delete_blob_snapshot(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) snapshot = self.bsc.get_blob_client( @@ -649,7 +649,7 @@ def test_delete_blob_snapshot(self, resource_group, location, storage_account, s @GlobalStorageAccountPreparer() def test_delete_blob_snapshots(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) blob.create_snapshot() @@ -666,7 +666,7 @@ def test_delete_blob_snapshots(self, resource_group, location, storage_account, @GlobalStorageAccountPreparer() def test_delete_blob_with_snapshots(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) blob.create_snapshot() @@ -686,7 +686,7 @@ def test_delete_blob_with_snapshots(self, resource_group, location, storage_acco @GlobalStorageAccountPreparer() def test_soft_delete_blob_without_snapshots(self, resource_group, location, storage_account, storage_account_key): try: - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self._enable_soft_delete() blob_name = self._create_block_blob() @@ -722,7 +722,7 @@ def test_soft_delete_blob_without_snapshots(self, resource_group, location, stor @GlobalStorageAccountPreparer() def test_soft_delete_single_blob_snapshot(self, resource_group, location, storage_account, storage_account_key): try: - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self._enable_soft_delete() blob_name = self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -769,7 +769,7 @@ def test_soft_delete_single_blob_snapshot(self, resource_group, location, storag @GlobalStorageAccountPreparer() def test_soft_delete_only_snapshots_of_blob(self, resource_group, location, storage_account, storage_account_key): try: - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self._enable_soft_delete() blob_name = self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -813,7 +813,7 @@ def test_soft_delete_only_snapshots_of_blob(self, resource_group, location, stor @GlobalStorageAccountPreparer() def test_soft_delete_blob_including_all_snapshots(self, resource_group, location, storage_account, storage_account_key): try: - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self._enable_soft_delete() blob_name = self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -852,7 +852,7 @@ def test_soft_delete_blob_including_all_snapshots(self, resource_group, location @GlobalStorageAccountPreparer() def test_soft_delete_with_leased_blob(self, resource_group, location, storage_account, storage_account_key): try: - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) self._enable_soft_delete() blob_name = self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -891,13 +891,13 @@ def test_soft_delete_with_leased_blob(self, resource_group, location, storage_ac @GlobalStorageAccountPreparer() def test_copy_blob_with_existing_blob(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) # Act sourceblob = '{0}/{1}/{2}'.format( - self.account_url(storage_account.name, "blob"), self.container_name, blob_name) + self.account_url(storage_account, "blob"), self.container_name, blob_name) copyblob = self.bsc.get_blob_client(self.container_name, 'blob1copy') copy = copyblob.start_copy_from_url(sourceblob) @@ -916,13 +916,13 @@ def test_copy_blob_with_existing_blob(self, resource_group, location, storage_ac def test_copy_blob_with_blob_tier_specified(self, resource_group, location, storage_account, storage_account_key): pytest.skip("Unable to set premium account") # Arrange - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() self.bsc.get_blob_client(self.container_name, blob_name) # Act sourceblob = '{0}/{1}/{2}'.format( - self.account_url(storage_account.name, "blob"), self.container_name, blob_name) + self.account_url(storage_account, "blob"), self.container_name, blob_name) copyblob = self.bsc.get_blob_client(self.container_name, 'blob1copy') blob_tier = StandardBlobTier.Cool @@ -938,12 +938,12 @@ def test_copy_blob_with_blob_tier_specified(self, resource_group, location, stor def test_copy_blob_with_rehydrate_priority(self, resource_group, location, storage_account, storage_account_key): # Arrange pytest.skip("Unabe to set up premium storage account type") - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() # Act sourceblob = '{0}/{1}/{2}'.format( - self.account_url(storage_account.name, "blob"), self.container_name, blob_name) + self.account_url(storage_account, "blob"), self.container_name, blob_name) blob_tier = StandardBlobTier.Archive rehydrate_priority = RehydratePriority.high @@ -982,8 +982,8 @@ def test_copy_blob_with_rehydrate_priority(self, resource_group, location, stora @GlobalStorageAccountPreparer() @StorageAccountPreparer(random_name_enabled=True, name_prefix='pyrmtstorage', parameter_name='rmt') def test_copy_blob_async_private_blob_no_sas(self, resource_group, location, storage_account, storage_account_key, rmt, rmt_key): - self._setup(storage_account.name, storage_account_key) - self._setup_remote(rmt.name, rmt_key) + self._setup(storage_account, storage_account_key) + self._setup_remote(rmt, rmt_key) self._create_remote_container() source_blob = self._create_remote_block_blob() @@ -998,9 +998,9 @@ def test_copy_blob_async_private_blob_no_sas(self, resource_group, location, sto @GlobalStorageAccountPreparer() @StorageAccountPreparer(random_name_enabled=True, name_prefix='pyrmtstorage', parameter_name='rmt') def test_copy_blob_async_private_blob_with_sas(self, resource_group, location, storage_account, storage_account_key, rmt, rmt_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) data = b'12345678' * 1024 * 1024 - self._setup_remote(rmt.name, rmt_key) + self._setup_remote(rmt, rmt_key) self._create_remote_container() source_blob = self._create_remote_block_blob(blob_data=data) sas_token = generate_blob_sas( @@ -1028,7 +1028,7 @@ def test_copy_blob_async_private_blob_with_sas(self, resource_group, location, s @GlobalStorageAccountPreparer() def test_abort_copy_blob(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) source_blob = "http://www.gutenberg.org/files/59466/59466-0.txt" copied_blob = self.bsc.get_blob_client(self.container_name, '59466-0.txt') @@ -1048,7 +1048,7 @@ def test_abort_copy_blob(self, resource_group, location, storage_account, storag @GlobalStorageAccountPreparer() def test_abort_copy_blob_with_synchronous_copy_fails(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) source_blob_name = self._create_block_blob() source_blob = self.bsc.get_blob_client(self.container_name, source_blob_name) @@ -1066,7 +1066,7 @@ def test_abort_copy_blob_with_synchronous_copy_fails(self, resource_group, locat @GlobalStorageAccountPreparer() def test_snapshot_blob(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() # Act @@ -1080,7 +1080,7 @@ def test_snapshot_blob(self, resource_group, location, storage_account, storage_ @GlobalStorageAccountPreparer() def test_lease_blob_acquire_and_release(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() # Act @@ -1096,7 +1096,7 @@ def test_lease_blob_acquire_and_release(self, resource_group, location, storage_ @GlobalStorageAccountPreparer() def test_lease_blob_with_duration(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() # Act @@ -1112,7 +1112,7 @@ def test_lease_blob_with_duration(self, resource_group, location, storage_accoun @GlobalStorageAccountPreparer() def test_lease_blob_with_proposed_lease_id(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() # Act @@ -1126,7 +1126,7 @@ def test_lease_blob_with_proposed_lease_id(self, resource_group, location, stora @GlobalStorageAccountPreparer() def test_lease_blob_change_lease_id(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() # Act @@ -1144,7 +1144,7 @@ def test_lease_blob_change_lease_id(self, resource_group, location, storage_acco @GlobalStorageAccountPreparer() def test_lease_blob_break_period(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() # Act @@ -1166,7 +1166,7 @@ def test_lease_blob_break_period(self, resource_group, location, storage_account @GlobalStorageAccountPreparer() def test_lease_blob_acquire_and_renew(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() # Act @@ -1181,7 +1181,7 @@ def test_lease_blob_acquire_and_renew(self, resource_group, location, storage_ac @GlobalStorageAccountPreparer() def test_lease_blob_acquire_twice_fails(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) lease = blob.acquire_lease() @@ -1196,7 +1196,7 @@ def test_lease_blob_acquire_twice_fails(self, resource_group, location, storage_ @GlobalStorageAccountPreparer() def test_unicode_get_blob_unicode_name(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = '啊齄丂狛狜' blob = self.bsc.get_blob_client(self.container_name, blob_name) blob.upload_blob(b'hello world') @@ -1210,7 +1210,7 @@ def test_unicode_get_blob_unicode_name(self, resource_group, location, storage_a @GlobalStorageAccountPreparer() def test_create_blob_blob_unicode_data(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -1224,7 +1224,7 @@ def test_create_blob_blob_unicode_data(self, resource_group, location, storage_a @GlobalStorageAccountPreparer() def test_no_sas_private_blob(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -1238,7 +1238,7 @@ def test_no_sas_private_blob(self, resource_group, location, storage_account, st @GlobalStorageAccountPreparer() def test_no_sas_public_blob(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) data = b'a public blob can be read without a shared access signature' blob_name = 'blob1.txt' container_name = self._get_container_reference() @@ -1258,7 +1258,7 @@ def test_no_sas_public_blob(self, resource_group, location, storage_account, sto @GlobalStorageAccountPreparer() def test_public_access_blob(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) data = b'public access blob' blob_name = 'blob1.txt' container_name = self._get_container_reference() @@ -1281,7 +1281,7 @@ def test_public_access_blob(self, resource_group, location, storage_account, sto def test_sas_access_blob(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -1308,7 +1308,7 @@ def test_sas_access_blob(self, resource_group, location, storage_account, storag def test_sas_access_blob_snapshot(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() blob_client = self.bsc.get_blob_client(self.container_name, blob_name) blob_snapshot = blob_client.create_snapshot() @@ -1344,7 +1344,7 @@ def test_sas_access_blob_snapshot(self, resource_group, location, storage_accoun def test_sas_signed_identifier(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() container = self.bsc.get_container_client(self.container_name) blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -1378,7 +1378,7 @@ def test_sas_signed_identifier(self, resource_group, location, storage_account, def test_account_sas(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() token = generate_account_sas( @@ -1406,11 +1406,11 @@ def test_account_sas(self, resource_group, location, storage_account, storage_ac @GlobalStorageAccountPreparer() def test_get_user_delegation_key(self, resource_group, location, storage_account, storage_account_key): # Act - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) token_credential = self.generate_oauth_token() # Action 1: make sure token works - service = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=token_credential) + service = BlobServiceClient(self.account_url(storage_account, "blob"), credential=token_credential) start = datetime.utcnow() expiry = datetime.utcnow() + timedelta(hours=1) @@ -1472,22 +1472,22 @@ def test_user_delegation_sas_for_blob(self): @GlobalStorageAccountPreparer() def test_token_credential(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) token_credential = self.generate_oauth_token() # Action 1: make sure token works - service = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=token_credential) + service = BlobServiceClient(self.account_url(storage_account, "blob"), credential=token_credential) result = service.get_service_properties() self.assertIsNotNone(result) # Action 2: change token value to make request fail fake_credential = self.generate_fake_token() - service = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=fake_credential) + service = BlobServiceClient(self.account_url(storage_account, "blob"), credential=fake_credential) with self.assertRaises(ClientAuthenticationError): service.get_service_properties() # Action 3: update token to make it working again - service = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=token_credential) + service = BlobServiceClient(self.account_url(storage_account, "blob"), credential=token_credential) result = service.get_service_properties() self.assertIsNotNone(result) @@ -1496,7 +1496,7 @@ def test_token_credential(self, resource_group, location, storage_account, stora def test_shared_read_access_blob(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -1524,7 +1524,7 @@ def test_shared_read_access_blob(self, resource_group, location, storage_account def test_shared_read_access_blob_with_content_query_params(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -1561,7 +1561,7 @@ def test_shared_read_access_blob_with_content_query_params(self, resource_group, def test_shared_write_access_blob(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) updated_data = b'updated blob data' blob_name = self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -1592,7 +1592,7 @@ def test_shared_write_access_blob(self, resource_group, location, storage_accoun def test_shared_delete_access_blob(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -1620,7 +1620,7 @@ def test_shared_delete_access_blob(self, resource_group, location, storage_accou @GlobalStorageAccountPreparer() def test_get_account_information(self, resource_group, location, storage_account, storage_account_key): # Act - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) info = self.bsc.get_account_information() # Assert @@ -1631,7 +1631,7 @@ def test_get_account_information(self, resource_group, location, storage_account @GlobalStorageAccountPreparer() def test_get_account_information_with_container_name(self, resource_group, location, storage_account, storage_account_key): # Act - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) # Container name gets ignored container = self.bsc.get_container_client("missing") info = container.get_account_information() @@ -1644,7 +1644,7 @@ def test_get_account_information_with_container_name(self, resource_group, locat @GlobalStorageAccountPreparer() def test_get_account_information_with_blob_name(self, resource_group, location, storage_account, storage_account_key): # Act - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) # Both container and blob names get ignored blob = self.bsc.get_blob_client("missing", "missing") info = blob.get_account_information() @@ -1658,7 +1658,7 @@ def test_get_account_information_with_blob_name(self, resource_group, location, def test_get_account_information_with_container_sas(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) container = self.bsc.get_container_client(self.container_name) token = generate_container_sas( container.account_name, @@ -1681,7 +1681,7 @@ def test_get_account_information_with_container_sas(self, resource_group, locati def test_get_account_information_with_blob_sas(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -1707,9 +1707,9 @@ def test_get_account_information_with_blob_sas(self, resource_group, location, s @GlobalStorageAccountPreparer() @StorageAccountPreparer(random_name_enabled=True, name_prefix='pyrmtstorage', parameter_name='rmt') def test_download_to_file_with_sas(self, resource_group, location, storage_account, storage_account_key, rmt, rmt_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) data = b'12345678' * 1024 * 1024 - self._setup_remote(rmt.name, rmt_key) + self._setup_remote(rmt, rmt_key) self._create_remote_container() source_blob = self._create_remote_block_blob(blob_data=data) sas_token = generate_blob_sas( @@ -1737,9 +1737,9 @@ def test_download_to_file_with_sas(self, resource_group, location, storage_accou @GlobalStorageAccountPreparer() @StorageAccountPreparer(random_name_enabled=True, name_prefix='pyrmtstorage', parameter_name='rmt') def test_download_to_file_with_credential(self, resource_group, location, storage_account, storage_account_key, rmt, rmt_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) data = b'12345678' * 1024 * 1024 - self._setup_remote(rmt.name, rmt_key) + self._setup_remote(rmt, rmt_key) self._create_remote_container() source_blob = self._create_remote_block_blob(blob_data=data) FILE_PATH = 'to_file_with_credential.temp.{}.dat'.format(str(uuid.uuid4())) @@ -1758,9 +1758,9 @@ def test_download_to_file_with_credential(self, resource_group, location, storag @GlobalStorageAccountPreparer() @StorageAccountPreparer(random_name_enabled=True, name_prefix='pyrmtstorage', parameter_name='rmt') def test_download_to_stream_with_credential(self, resource_group, location, storage_account, storage_account_key, rmt, rmt_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) data = b'12345678' * 1024 * 1024 - self._setup_remote(rmt.name, rmt_key) + self._setup_remote(rmt, rmt_key) self._create_remote_container() source_blob = self._create_remote_block_blob(blob_data=data) FILE_PATH = 'download_to_stream_with_credential.temp.{}.dat'.format(str(uuid.uuid4())) @@ -1781,9 +1781,9 @@ def test_download_to_stream_with_credential(self, resource_group, location, stor @GlobalStorageAccountPreparer() @StorageAccountPreparer(random_name_enabled=True, name_prefix='pyrmtstorage', parameter_name='rmt') def test_download_to_file_with_existing_file(self, resource_group, location, storage_account, storage_account_key, rmt, rmt_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) data = b'12345678' * 1024 * 1024 - self._setup_remote(rmt.name, rmt_key) + self._setup_remote(rmt, rmt_key) self._create_remote_container() source_blob = self._create_remote_block_blob(blob_data=data) FILE_PATH = 'file_with_existing_file.temp.{}.dat'.format(str(uuid.uuid4())) @@ -1805,9 +1805,9 @@ def test_download_to_file_with_existing_file(self, resource_group, location, sto @GlobalStorageAccountPreparer() @StorageAccountPreparer(random_name_enabled=True, name_prefix='pyrmtstorage', parameter_name='rmt') def test_download_to_file_with_existing_file_overwrite(self, resource_group, location, storage_account, storage_account_key, rmt, rmt_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) data = b'12345678' * 1024 * 1024 - self._setup_remote(rmt.name, rmt_key) + self._setup_remote(rmt, rmt_key) self._create_remote_container() source_blob = self._create_remote_block_blob(blob_data=data) FILE_PATH = 'file_with_existing_file_overwrite.temp.{}.dat'.format(str(uuid.uuid4())) @@ -1833,7 +1833,7 @@ def test_download_to_file_with_existing_file_overwrite(self, resource_group, loc def test_upload_to_url_bytes_with_sas(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) data = b'12345678' * 1024 * 1024 blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -1862,7 +1862,7 @@ def test_upload_to_url_bytes_with_sas(self, resource_group, location, storage_ac def test_upload_to_url_bytes_with_credential(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) data = b'12345678' * 1024 * 1024 blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -1881,7 +1881,7 @@ def test_upload_to_url_bytes_with_credential(self, resource_group, location, sto def test_upload_to_url_bytes_with_existing_blob(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) data = b'12345678' * 1024 * 1024 blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -1901,7 +1901,7 @@ def test_upload_to_url_bytes_with_existing_blob(self, resource_group, location, def test_upload_to_url_bytes_with_existing_blob_overwrite(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) data = b'12345678' * 1024 * 1024 blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -1923,7 +1923,7 @@ def test_upload_to_url_bytes_with_existing_blob_overwrite(self, resource_group, def test_upload_to_url_text_with_credential(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) data = '12345678' * 1024 * 1024 blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -1944,7 +1944,7 @@ def test_upload_to_url_text_with_credential(self, resource_group, location, stor def test_upload_to_url_file_with_credential(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only FILE_PATH = 'upload_to_url_file_with_credential.temp.{}.dat'.format(str(uuid.uuid4())) - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) data = b'12345678' * 1024 * 1024 with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -1981,7 +1981,7 @@ def test_set_blob_permission(self): def test_transport_closed_only_once(self, resource_group, location, storage_account, storage_account_key): container_name = self.get_resource_name('utcontainersync') transport = RequestsTransport() - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, transport=transport) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, transport=transport) blob_name = self._get_blob_reference() with bsc: bsc.get_service_properties() 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 b67130eb31fd..35e1537efe78 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 @@ -74,8 +74,8 @@ async def send(self, request, **config): class StorageCommonBlobTestAsync(AsyncStorageTestCase): # --Helpers----------------------------------------------------------------- - async def _setup(self, name, key): - self.bsc = BlobServiceClient(self.account_url(name, "blob"), credential=key, transport=AiohttpTestTransport()) + async def _setup(self, storage_account, key): + self.bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=key, transport=AiohttpTestTransport()) self.container_name = self.get_resource_name('utcontainer') self.byte_data = self.get_random_bytes(1024) if self.is_live: @@ -85,8 +85,8 @@ async def _setup(self, name, key): except ResourceExistsError: pass - async def _setup_remote(self, name, key): - self.bsc2 = BlobServiceClient(self.account_url(name, "blob"), credential=key) + async def _setup_remote(self, storage_account, key): + self.bsc2 = BlobServiceClient(self.account_url(storage_account, "blob"), credential=key) self.remote_container_name = 'rmt' def _teardown(self, FILE_PATH): @@ -162,7 +162,7 @@ def _assert_blob_not_soft_deleted(self, blob): @AsyncStorageTestCase.await_prepared_test async def test_blob_exists(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() # Act @@ -177,7 +177,7 @@ async def test_blob_exists(self, resource_group, location, storage_account, stor @AsyncStorageTestCase.await_prepared_test async def test_blob_not_exists(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() # Act @@ -190,7 +190,7 @@ async def test_blob_not_exists(self, resource_group, location, storage_account, @AsyncStorageTestCase.await_prepared_test async def test_blob_snapshot_exists(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) snapshot = await blob.create_snapshot() @@ -207,7 +207,7 @@ async def test_blob_snapshot_exists(self, resource_group, location, storage_acco @AsyncStorageTestCase.await_prepared_test async def test_blob_snapshot_not_exists(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() # Act @@ -221,7 +221,7 @@ async def test_blob_snapshot_not_exists(self, resource_group, location, storage_ async def test_blob_container_not_exists(self, resource_group, location, storage_account, storage_account_key): # In this case both the blob and container do not exist # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() # Act @@ -234,7 +234,7 @@ async def test_blob_container_not_exists(self, resource_group, location, storage @AsyncStorageTestCase.await_prepared_test async def test_create_blob_with_question_mark(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = '?ques?tion?' blob_data = u'???' @@ -254,7 +254,7 @@ async def test_create_blob_with_question_mark(self, resource_group, location, st @AsyncStorageTestCase.await_prepared_test async def test_create_blob_with_special_chars(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) # Act for c in '-._ /()$=\',~': blob_name = '{0}a{0}a{0}'.format(c) @@ -272,7 +272,7 @@ async def test_create_blob_with_special_chars(self, resource_group, location, st @AsyncStorageTestCase.await_prepared_test async def test_create_blob_with_lease_id(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) lease = await blob.acquire_lease() @@ -292,7 +292,7 @@ async def test_create_blob_with_lease_id(self, resource_group, location, storage @AsyncStorageTestCase.await_prepared_test async def test_create_blob_with_metadata(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() metadata = {'hello': 'world', 'number': '42'} @@ -309,7 +309,7 @@ async def test_create_blob_with_metadata(self, resource_group, location, storage @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_create_blob_with_generator_async(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) # Act def gen(): @@ -328,7 +328,7 @@ def gen(): @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_create_blob_with_requests_async(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) # Act uri = "http://www.gutenberg.org/files/59466/59466-0.txt" data = requests.get(uri, stream=True) @@ -341,7 +341,7 @@ async def test_create_blob_with_requests_async(self, resource_group, location, s @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_create_blob_with_aiohttp_async(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob = self.bsc.get_blob_client(self.container_name, "gutenberg_async") # Act uri = "http://www.gutenberg.org/files/59466/59466-0.txt" @@ -355,7 +355,7 @@ async def test_create_blob_with_aiohttp_async(self, resource_group, location, st @AsyncStorageTestCase.await_prepared_test async def test_get_blob_with_existing_blob(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() # Act @@ -371,7 +371,7 @@ async def test_get_blob_with_existing_blob(self, resource_group, location, stora @AsyncStorageTestCase.await_prepared_test async def test_get_blob_with_snapshot(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) snap = await blob.create_snapshot() @@ -390,7 +390,7 @@ async def test_get_blob_with_snapshot(self, resource_group, location, storage_ac @AsyncStorageTestCase.await_prepared_test async def test_get_blob_with_snapshot_previous(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) snap = await blob.create_snapshot() @@ -415,7 +415,7 @@ async def test_get_blob_with_snapshot_previous(self, resource_group, location, s @AsyncStorageTestCase.await_prepared_test async def test_get_blob_with_range(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() # Act @@ -431,7 +431,7 @@ async def test_get_blob_with_range(self, resource_group, location, storage_accou @AsyncStorageTestCase.await_prepared_test async def test_get_blob_with_lease(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) lease = await blob.acquire_lease() @@ -449,7 +449,7 @@ async def test_get_blob_with_lease(self, resource_group, location, storage_accou @AsyncStorageTestCase.await_prepared_test async def test_get_blob_with_non_existing_blob(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() # Act @@ -463,7 +463,7 @@ async def test_get_blob_with_non_existing_blob(self, resource_group, location, s @AsyncStorageTestCase.await_prepared_test async def test_set_blob_properties_with_existing_blob(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() # Act @@ -484,7 +484,7 @@ async def test_set_blob_properties_with_existing_blob(self, resource_group, loca @AsyncStorageTestCase.await_prepared_test async def test_set_blob_properties_with_blob_settings_param(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) props = await blob.get_blob_properties() @@ -504,7 +504,7 @@ async def test_set_blob_properties_with_blob_settings_param(self, resource_group @AsyncStorageTestCase.await_prepared_test async def test_get_blob_properties(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() # Act @@ -523,7 +523,7 @@ async def test_get_blob_properties(self, resource_group, location, storage_accou @AsyncStorageTestCase.await_prepared_test async def test_get_blob_properties_fail(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() # Act @@ -543,7 +543,7 @@ async def test_get_blob_properties_fail(self, resource_group, location, storage_ @AsyncStorageTestCase.await_prepared_test async def test_get_blob_metadata_fail(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() # Act @@ -560,7 +560,7 @@ async def test_get_blob_metadata_fail(self, resource_group, location, storage_ac @AsyncStorageTestCase.await_prepared_test async def test_get_blob_server_encryption(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() # Act @@ -575,7 +575,7 @@ async def test_get_blob_server_encryption(self, resource_group, location, storag @AsyncStorageTestCase.await_prepared_test async def test_get_blob_properties_server_encryption(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() # Act @@ -591,7 +591,7 @@ async def test_get_blob_properties_server_encryption(self, resource_group, locat async def test_list_blobs_server_encryption(self, resource_group, location, storage_account, storage_account_key): # test can only run live # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) await self._create_block_blob() container = self.bsc.get_container_client(self.container_name) blob_list = [] @@ -610,7 +610,7 @@ async def test_list_blobs_server_encryption(self, resource_group, location, stor async def test_no_server_encryption(self, resource_group, location, storage_account, storage_account_key): pytest.skip("Aiohttp headers dict (CIMultiDictProxy) is immutable.") # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -628,7 +628,7 @@ def callback(response): @AsyncStorageTestCase.await_prepared_test async def test_get_blob_properties_with_snapshot(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() container = self.bsc.get_container_client(self.container_name) blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -653,7 +653,7 @@ async def test_get_blob_properties_with_snapshot(self, resource_group, location, @AsyncStorageTestCase.await_prepared_test async def test_get_blob_properties_with_leased_blob(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) lease = await blob.acquire_lease() @@ -674,7 +674,7 @@ async def test_get_blob_properties_with_leased_blob(self, resource_group, locati @AsyncStorageTestCase.await_prepared_test async def test_get_blob_metadata(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() # Act @@ -691,7 +691,7 @@ async def test_set_blob_metadata_with_upper_case(self, resource_group, location, # bug in devtools...converts upper case header to lowercase # passes live. # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) metadata = {'hello': 'world', 'number': '42', 'UP': 'UPval'} blob_name = await self._create_block_blob() @@ -712,7 +712,7 @@ async def test_set_blob_metadata_with_upper_case(self, resource_group, location, @AsyncStorageTestCase.await_prepared_test async def test_delete_blob_with_existing_blob(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() # Act @@ -727,7 +727,7 @@ async def test_delete_blob_with_existing_blob(self, resource_group, location, st @AsyncStorageTestCase.await_prepared_test async def test_delete_blob_with_non_existing_blob(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() # Act @@ -742,7 +742,7 @@ async def test_delete_blob_with_non_existing_blob(self, resource_group, location @AsyncStorageTestCase.await_prepared_test async def test_delete_blob_snapshot(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) snap = await blob.create_snapshot() @@ -766,7 +766,7 @@ async def test_delete_blob_snapshot(self, resource_group, location, storage_acco @AsyncStorageTestCase.await_prepared_test async def test_delete_blob_snapshots(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) await blob.create_snapshot() @@ -787,7 +787,7 @@ async def test_delete_blob_snapshots(self, resource_group, location, storage_acc @AsyncStorageTestCase.await_prepared_test async def test_delete_blob_with_snapshots(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) await blob.create_snapshot() @@ -811,7 +811,7 @@ async def test_delete_blob_with_snapshots(self, resource_group, location, storag async def test_soft_delete_blob_without_snapshots(self, resource_group, location, storage_account, storage_account_key): try: # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) await self._enable_soft_delete() blob_name = await self._create_block_blob() @@ -856,7 +856,7 @@ async def test_soft_delete_blob_without_snapshots(self, resource_group, location async def test_soft_delete_single_blob_snapshot(self, resource_group, location, storage_account, storage_account_key): try: # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) await self._enable_soft_delete() blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -911,7 +911,7 @@ async def test_soft_delete_single_blob_snapshot(self, resource_group, location, async def test_soft_delete_only_snapshots_of_blob(self, resource_group, location, storage_account, storage_account_key): try: # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) await self._enable_soft_delete() blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -963,7 +963,7 @@ async def test_soft_delete_only_snapshots_of_blob(self, resource_group, location async def test_soft_delete_blob_including_all_snapshots(self, resource_group, location, storage_account, storage_account_key): try: # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) await self._enable_soft_delete() blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -1010,7 +1010,7 @@ async def test_soft_delete_blob_including_all_snapshots(self, resource_group, lo async def test_soft_delete_with_leased_blob(self, resource_group, location, storage_account, storage_account_key): try: # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) await self._enable_soft_delete() blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -1057,13 +1057,13 @@ async def test_soft_delete_with_leased_blob(self, resource_group, location, stor @AsyncStorageTestCase.await_prepared_test async def test_copy_blob_with_existing_blob(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) # Act sourceblob = '{0}/{1}/{2}'.format( - self.account_url(storage_account.name, "blob"), self.container_name, blob_name) + self.account_url(storage_account, "blob"), self.container_name, blob_name) copyblob = self.bsc.get_blob_client(self.container_name, 'blob1copy') copy = await copyblob.start_copy_from_url(sourceblob) @@ -1107,8 +1107,8 @@ async def test_copy_blob_with_existing_blob(self, resource_group, location, stor @AsyncStorageTestCase.await_prepared_test async def test_copy_blob_async_private_blob_no_sas(self, resource_group, location, storage_account, storage_account_key, rmt, rmt_key): # Arrange - await self._setup(storage_account.name, storage_account_key) - await self._setup_remote(rmt.name, rmt_key) + await self._setup(storage_account, storage_account_key) + await self._setup_remote(rmt, rmt_key) await self._create_remote_container() source_blob = await self._create_remote_block_blob() @@ -1126,9 +1126,9 @@ async def test_copy_blob_async_private_blob_no_sas(self, resource_group, locatio @AsyncStorageTestCase.await_prepared_test async def test_copy_blob_async_private_blob_with_sas(self, resource_group, location, storage_account, storage_account_key, rmt, rmt_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) data = b'12345678' * 1024 * 1024 - await self._setup_remote(rmt.name, rmt_key) + await self._setup_remote(rmt, rmt_key) await self._create_remote_container() source_blob = await self._create_remote_block_blob(blob_data=data) sas_token = generate_blob_sas( @@ -1158,7 +1158,7 @@ async def test_copy_blob_async_private_blob_with_sas(self, resource_group, locat @AsyncStorageTestCase.await_prepared_test async def test_abort_copy_blob(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) source_blob = "http://www.gutenberg.org/files/59466/59466-0.txt" copied_blob = self.bsc.get_blob_client(self.container_name, '59466-0.txt') @@ -1181,7 +1181,7 @@ async def test_abort_copy_blob(self, resource_group, location, storage_account, @AsyncStorageTestCase.await_prepared_test async def test_abort_copy_blob_with_synchronous_copy_fails(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) source_blob_name = await self._create_block_blob() source_blob = self.bsc.get_blob_client(self.container_name, source_blob_name) @@ -1201,7 +1201,7 @@ async def test_abort_copy_blob_with_synchronous_copy_fails(self, resource_group, @AsyncStorageTestCase.await_prepared_test async def test_snapshot_blob(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() # Act @@ -1217,7 +1217,7 @@ async def test_snapshot_blob(self, resource_group, location, storage_account, st @AsyncStorageTestCase.await_prepared_test async def test_lease_blob_acquire_and_release(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() # Act @@ -1235,7 +1235,7 @@ async def test_lease_blob_acquire_and_release(self, resource_group, location, st @AsyncStorageTestCase.await_prepared_test async def test_lease_blob_with_duration(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() # Act @@ -1253,7 +1253,7 @@ async def test_lease_blob_with_duration(self, resource_group, location, storage_ @AsyncStorageTestCase.await_prepared_test async def test_lease_blob_with_proposed_lease_id(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() # Act @@ -1269,7 +1269,7 @@ async def test_lease_blob_with_proposed_lease_id(self, resource_group, location, @AsyncStorageTestCase.await_prepared_test async def test_lease_blob_change_lease_id(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() # Act @@ -1289,7 +1289,7 @@ async def test_lease_blob_change_lease_id(self, resource_group, location, storag @AsyncStorageTestCase.await_prepared_test async def test_lease_blob_break_period(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() # Act @@ -1313,7 +1313,7 @@ async def test_lease_blob_break_period(self, resource_group, location, storage_a @AsyncStorageTestCase.await_prepared_test async def test_lease_blob_acquire_and_renew(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() # Act @@ -1330,7 +1330,7 @@ async def test_lease_blob_acquire_and_renew(self, resource_group, location, stor @AsyncStorageTestCase.await_prepared_test async def test_lease_blob_acquire_twice_fails(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) lease = await blob.acquire_lease() @@ -1347,7 +1347,7 @@ async def test_lease_blob_acquire_twice_fails(self, resource_group, location, st @AsyncStorageTestCase.await_prepared_test async def test_unicode_get_blob_unicode_name(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = '啊齄丂狛狜' blob = self.bsc.get_blob_client(self.container_name, blob_name) await blob.upload_blob(b'hello world') @@ -1364,7 +1364,7 @@ async def test_unicode_get_blob_unicode_name(self, resource_group, location, sto @AsyncStorageTestCase.await_prepared_test async def test_create_blob_blob_unicode_data(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -1380,7 +1380,7 @@ async def test_create_blob_blob_unicode_data(self, resource_group, location, sto @AsyncStorageTestCase.await_prepared_test async def test_no_sas_private_blob(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -1396,7 +1396,7 @@ async def test_no_sas_private_blob(self, resource_group, location, storage_accou @AsyncStorageTestCase.await_prepared_test async def test_no_sas_public_blob(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) data = b'a public blob can be read without a shared access signature' blob_name = 'blob1.txt' container_name = self._get_container_reference() @@ -1418,7 +1418,7 @@ async def test_no_sas_public_blob(self, resource_group, location, storage_accoun @AsyncStorageTestCase.await_prepared_test async def test_public_access_blob(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) data = b'public access blob' blob_name = 'blob1.txt' container_name = self._get_container_reference() @@ -1443,7 +1443,7 @@ async def test_sas_access_blob(self, resource_group, location, storage_account, # SAS URL is calculated from storage key, so this test runs live only # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -1472,7 +1472,7 @@ async def test_sas_signed_identifier(self, resource_group, location, storage_acc # SAS URL is calculated from storage key, so this test runs live only # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() container = self.bsc.get_container_client(self.container_name) blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -1508,7 +1508,7 @@ async def test_account_sas(self, resource_group, location, storage_account, stor # SAS URL is calculated from storage key, so this test runs live only # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() token = generate_account_sas( @@ -1538,22 +1538,22 @@ async def test_account_sas(self, resource_group, location, storage_account, stor @AsyncStorageTestCase.await_prepared_test async def test_token_credential(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) token_credential = self.generate_oauth_token() # Action 1: make sure token works - service = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=token_credential, transport=AiohttpTestTransport()) + service = BlobServiceClient(self.account_url(storage_account, "blob"), credential=token_credential, transport=AiohttpTestTransport()) result = await service.get_service_properties() self.assertIsNotNone(result) # Action 2: change token value to make request fail fake_credential = self.generate_fake_token() - service = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=fake_credential, transport=AiohttpTestTransport()) + service = BlobServiceClient(self.account_url(storage_account, "blob"), credential=fake_credential, transport=AiohttpTestTransport()) with self.assertRaises(ClientAuthenticationError): await service.get_service_properties() # Action 3: update token to make it working again - service = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=token_credential, transport=AiohttpTestTransport()) + service = BlobServiceClient(self.account_url(storage_account, "blob"), credential=token_credential, transport=AiohttpTestTransport()) result = await service.get_service_properties() self.assertIsNotNone(result) @@ -1563,7 +1563,7 @@ async def test_token_credential(self, resource_group, location, storage_account, async def test_shared_read_access_blob(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) # Arrange blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -1594,7 +1594,7 @@ async def test_shared_read_access_blob_with_content_query_params(self, resource_ # SAS URL is calculated from storage key, so this test runs live only # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -1633,7 +1633,7 @@ async def test_shared_write_access_blob(self, resource_group, location, storage_ # SAS URL is calculated from storage key, so this test runs live only # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) updated_data = b'updated blob data' blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -1666,7 +1666,7 @@ async def test_shared_delete_access_blob(self, resource_group, location, storage # SAS URL is calculated from storage key, so this test runs live only # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -1695,7 +1695,7 @@ async def test_shared_delete_access_blob(self, resource_group, location, storage @AsyncStorageTestCase.await_prepared_test async def test_get_account_information(self, resource_group, location, storage_account, storage_account_key): # Act - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) info = await self.bsc.get_account_information() # Assert @@ -1708,7 +1708,7 @@ async def test_get_account_information(self, resource_group, location, storage_a async def test_get_account_information_with_container_name(self, resource_group, location, storage_account, storage_account_key): # Act # Container name gets ignored - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) container = self.bsc.get_container_client("missing") info = await container.get_account_information() @@ -1722,7 +1722,7 @@ async def test_get_account_information_with_container_name(self, resource_group, async def test_get_account_information_with_blob_name(self, resource_group, location, storage_account, storage_account_key): # Act # Both container and blob names get ignored - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob = self.bsc.get_blob_client("missing", "missing") info = await blob.get_account_information() @@ -1737,7 +1737,7 @@ async def test_get_account_information_with_container_sas(self, resource_group, # SAS URL is calculated from storage key, so this test runs live only # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) container = self.bsc.get_container_client(self.container_name) token = generate_container_sas( container.account_name, @@ -1762,7 +1762,7 @@ async def test_get_account_information_with_blob_sas(self, resource_group, locat # SAS URL is calculated from storage key, so this test runs live only # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = await self._create_block_blob() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -1790,9 +1790,9 @@ async def test_get_account_information_with_blob_sas(self, resource_group, locat @AsyncStorageTestCase.await_prepared_test async def test_download_to_file_with_sas(self, resource_group, location, storage_account, storage_account_key, rmt, rmt_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) data = b'12345678' * 1024 * 1024 - await self._setup_remote(rmt.name, rmt_key) + await self._setup_remote(rmt, rmt_key) await self._create_remote_container() source_blob = await self._create_remote_block_blob(blob_data=data) sas_token = generate_blob_sas( @@ -1822,9 +1822,9 @@ async def test_download_to_file_with_sas(self, resource_group, location, storage @AsyncStorageTestCase.await_prepared_test async def test_download_to_file_with_credential(self, resource_group, location, storage_account, storage_account_key, rmt, rmt_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) data = b'12345678' * 1024 * 1024 - await self._setup_remote(rmt.name, rmt_key) + await self._setup_remote(rmt, rmt_key) await self._create_remote_container() source_blob = await self._create_remote_block_blob(blob_data=data) FILE_PATH = 'to_file_with_credential.async.{}.dat'.format(str(uuid.uuid4())) @@ -1846,9 +1846,9 @@ async def test_download_to_file_with_credential(self, resource_group, location, @AsyncStorageTestCase.await_prepared_test async def test_download_to_stream_with_credential(self, resource_group, location, storage_account, storage_account_key, rmt, rmt_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) data = b'12345678' * 1024 * 1024 - await self._setup_remote(rmt.name, rmt_key) + await self._setup_remote(rmt, rmt_key) await self._create_remote_container() source_blob = await self._create_remote_block_blob(blob_data=data) FILE_PATH = 'to_stream_with_credential.async.{}.dat'.format(str(uuid.uuid4())) @@ -1871,9 +1871,9 @@ async def test_download_to_stream_with_credential(self, resource_group, location @AsyncStorageTestCase.await_prepared_test async def test_download_to_file_with_existing_file(self, resource_group, location, storage_account, storage_account_key, rmt, rmt_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) data = b'12345678' * 1024 * 1024 - await self._setup_remote(rmt.name, rmt_key) + await self._setup_remote(rmt, rmt_key) await self._create_remote_container() source_blob = await self._create_remote_block_blob(blob_data=data) FILE_PATH = 'with_existing_file.async.{}.dat'.format(str(uuid.uuid4())) @@ -1897,9 +1897,9 @@ async def test_download_to_file_with_existing_file(self, resource_group, locatio @AsyncStorageTestCase.await_prepared_test async def test_download_to_file_with_existing_file_overwrite(self, resource_group, location, storage_account, storage_account_key, rmt, rmt_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) data = b'12345678' * 1024 * 1024 - await self._setup_remote(rmt.name, rmt_key) + await self._setup_remote(rmt, rmt_key) await self._create_remote_container() source_blob = await self._create_remote_block_blob(blob_data=data) FILE_PATH = 'existing_file_overwrite.async.{}.dat'.format(str(uuid.uuid4())) @@ -1927,7 +1927,7 @@ async def test_upload_to_url_bytes_with_sas(self, resource_group, location, stor # SAS URL is calculated from storage key, so this test runs live only # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) data = b'12345678' * 1024 * 1024 blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -1958,7 +1958,7 @@ async def test_upload_to_url_bytes_with_credential(self, resource_group, locatio # SAS URL is calculated from storage key, so this test runs live only # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) data = b'12345678' * 1024 * 1024 blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -1979,7 +1979,7 @@ async def test_upload_to_url_bytes_with_existing_blob(self, resource_group, loca # SAS URL is calculated from storage key, so this test runs live only # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) data = b'12345678' * 1024 * 1024 blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -2001,7 +2001,7 @@ async def test_upload_to_url_bytes_with_existing_blob_overwrite(self, resource_g # SAS URL is calculated from storage key, so this test runs live only # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) data = b'12345678' * 1024 * 1024 blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -2025,7 +2025,7 @@ async def test_upload_to_url_text_with_credential(self, resource_group, location # SAS URL is calculated from storage key, so this test runs live only # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) data = '12345678' * 1024 * 1024 blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -2047,7 +2047,7 @@ async def test_upload_to_url_file_with_credential(self, resource_group, location # SAS URL is calculated from storage key, so this test runs live only # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) data = b'12345678' * 1024 * 1024 FILE_PATH = 'url_file_with_credential.async.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: @@ -2071,7 +2071,7 @@ async def test_upload_to_url_file_with_credential(self, resource_group, location async def test_transport_closed_only_once(self, resource_group, location, storage_account, storage_account_key): container_name = self.get_resource_name('utcontainerasync') transport = AioHttpTransport() - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, transport=transport) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, transport=transport) blob_name = self._get_blob_reference() async with bsc: await bsc.get_service_properties() diff --git a/sdk/storage/azure-storage-blob/tests/test_container.py b/sdk/storage/azure-storage-blob/tests/test_container.py index 942ad41ec911..11bfb86f0deb 100644 --- a/sdk/storage/azure-storage-blob/tests/test_container.py +++ b/sdk/storage/azure-storage-blob/tests/test_container.py @@ -57,7 +57,7 @@ def _create_container(self, bsc, prefix=TEST_CONTAINER_PREFIX): #--Test cases for containers ----------------------------------------- @GlobalStorageAccountPreparer() def test_create_container(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container_name = self._get_container_reference() # Act @@ -69,7 +69,7 @@ def test_create_container(self, resource_group, location, storage_account, stora @GlobalStorageAccountPreparer() def test_create_container_with_already_existing_container_fail_on_exist(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container_name = self._get_container_reference() # Act @@ -83,7 +83,7 @@ def test_create_container_with_already_existing_container_fail_on_exist(self, re @GlobalStorageAccountPreparer() def test_create_container_with_public_access_container(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container_name = self._get_container_reference() # Act @@ -95,7 +95,7 @@ def test_create_container_with_public_access_container(self, resource_group, loc @GlobalStorageAccountPreparer() def test_create_container_with_public_access_blob(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container_name = self._get_container_reference() # Act @@ -106,7 +106,7 @@ def test_create_container_with_public_access_blob(self, resource_group, location blob.upload_blob(u'xyz') anonymous_service = BlobClient( - self.account_url(storage_account.name, "blob"), + self.account_url(storage_account, "blob"), container_name=container_name, blob_name="blob1") @@ -116,7 +116,7 @@ def test_create_container_with_public_access_blob(self, resource_group, location @GlobalStorageAccountPreparer() def test_create_container_with_metadata(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container_name = self._get_container_reference() metadata = {'hello': 'world', 'number': '42'} @@ -131,7 +131,7 @@ def test_create_container_with_metadata(self, resource_group, location, storage_ @GlobalStorageAccountPreparer() def test_container_exists_with_lease(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) container.acquire_lease() @@ -143,7 +143,7 @@ def test_container_exists_with_lease(self, resource_group, location, storage_acc @GlobalStorageAccountPreparer() def test_unicode_create_container_unicode_name(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container_name = u'啊齄丂狛狜' container = bsc.get_container_client(container_name) @@ -156,7 +156,7 @@ def test_unicode_create_container_unicode_name(self, resource_group, location, s @GlobalStorageAccountPreparer() def test_list_containers(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) # Act @@ -172,7 +172,7 @@ def test_list_containers(self, resource_group, location, storage_account, storag @GlobalStorageAccountPreparer() def test_list_containers_with_prefix(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) # Act @@ -187,7 +187,7 @@ def test_list_containers_with_prefix(self, resource_group, location, storage_acc @GlobalStorageAccountPreparer() def test_list_containers_with_include_metadata(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) metadata = {'hello': 'world', 'number': '42'} resp = container.set_container_metadata(metadata) @@ -206,7 +206,7 @@ def test_list_containers_with_include_metadata(self, resource_group, location, s @GlobalStorageAccountPreparer() def test_list_containers_with_public_access(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) access_policy = AccessPolicy(permission=ContainerSasPermissions(read=True), expiry=datetime.utcnow() + timedelta(hours=1), @@ -226,7 +226,7 @@ def test_list_containers_with_public_access(self, resource_group, location, stor @GlobalStorageAccountPreparer() def test_list_containers_with_num_results_and_marker(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) prefix = 'listcontainersync' container_names = [] for i in range(0, 4): @@ -254,7 +254,7 @@ def test_list_containers_with_num_results_and_marker(self, resource_group, locat @GlobalStorageAccountPreparer() def test_set_container_metadata(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) metadata = {'hello': 'world', 'number': '43'} container = self._create_container(bsc) @@ -266,7 +266,7 @@ def test_set_container_metadata(self, resource_group, location, storage_account, @GlobalStorageAccountPreparer() def test_set_container_metadata_with_lease_id(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) metadata = {'hello': 'world', 'number': '43'} container = self._create_container(bsc) lease_id = container.acquire_lease() @@ -280,7 +280,7 @@ def test_set_container_metadata_with_lease_id(self, resource_group, location, st @GlobalStorageAccountPreparer() def test_set_container_metadata_with_non_existing_container(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container_name = self._get_container_reference() container = bsc.get_container_client(container_name) @@ -292,7 +292,7 @@ def test_set_container_metadata_with_non_existing_container(self, resource_group @GlobalStorageAccountPreparer() def test_get_container_metadata(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) metadata = {'hello': 'world', 'number': '42'} container = self._create_container(bsc) container.set_container_metadata(metadata) @@ -305,7 +305,7 @@ def test_get_container_metadata(self, resource_group, location, storage_account, @GlobalStorageAccountPreparer() def test_get_container_metadata_with_lease_id(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) metadata = {'hello': 'world', 'number': '42'} container = self._create_container(bsc) container.set_container_metadata(metadata) @@ -319,7 +319,7 @@ def test_get_container_metadata_with_lease_id(self, resource_group, location, st @GlobalStorageAccountPreparer() def test_get_container_properties(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) metadata = {'hello': 'world', 'number': '42'} container = self._create_container(bsc) container.set_container_metadata(metadata) @@ -339,7 +339,7 @@ def test_get_container_properties(self, resource_group, location, storage_accoun @GlobalStorageAccountPreparer() def test_get_container_properties_with_lease_id(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) metadata = {'hello': 'world', 'number': '42'} container = self._create_container(bsc) container.set_container_metadata(metadata) @@ -358,7 +358,7 @@ def test_get_container_properties_with_lease_id(self, resource_group, location, @GlobalStorageAccountPreparer() def test_get_container_acl(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) # Act @@ -371,7 +371,7 @@ def test_get_container_acl(self, resource_group, location, storage_account, stor @GlobalStorageAccountPreparer() def test_get_container_acl_with_lease_id(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) lease_id = container.acquire_lease() @@ -384,7 +384,7 @@ def test_get_container_acl_with_lease_id(self, resource_group, location, storage @GlobalStorageAccountPreparer() def test_set_container_acl(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) # Act @@ -405,7 +405,7 @@ def test_set_container_acl(self, resource_group, location, storage_account, stor @GlobalStorageAccountPreparer() def test_set_container_acl_with_one_signed_identifier(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) from dateutil.tz import tzutc container = self._create_container(bsc) @@ -423,7 +423,7 @@ def test_set_container_acl_with_one_signed_identifier(self, resource_group, loca @GlobalStorageAccountPreparer() def test_set_container_acl_with_one_signed_identifier(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) # Act @@ -440,7 +440,7 @@ def test_set_container_acl_with_one_signed_identifier(self, resource_group, loca @GlobalStorageAccountPreparer() def test_set_container_acl_with_lease_id(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) lease_id = container.acquire_lease() @@ -459,7 +459,7 @@ def test_set_container_acl_with_lease_id(self, resource_group, location, storage @GlobalStorageAccountPreparer() def test_set_container_acl_with_public_access(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) # Act @@ -472,7 +472,7 @@ def test_set_container_acl_with_public_access(self, resource_group, location, st @GlobalStorageAccountPreparer() def test_set_container_acl_with_empty_signed_identifiers(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) # Act @@ -486,7 +486,7 @@ def test_set_container_acl_with_empty_signed_identifiers(self, resource_group, l @GlobalStorageAccountPreparer() def test_set_container_acl_with_empty_access_policy(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) identifier = {'empty': None} @@ -501,7 +501,7 @@ def test_set_container_acl_with_empty_access_policy(self, resource_group, locati @GlobalStorageAccountPreparer() def test_set_container_acl_with_signed_identifiers(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) # Act @@ -519,7 +519,7 @@ def test_set_container_acl_with_signed_identifiers(self, resource_group, locatio @GlobalStorageAccountPreparer() def test_set_container_acl_with_empty_identifiers(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) identifiers = {i: None for i in range(2)} @@ -536,7 +536,7 @@ def test_set_container_acl_with_empty_identifiers(self, resource_group, location @GlobalStorageAccountPreparer() def test_set_container_acl_with_three_identifiers(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) access_policy = AccessPolicy(permission=ContainerSasPermissions(read=True), expiry=datetime.utcnow() + timedelta(hours=1), @@ -556,7 +556,7 @@ def test_set_container_acl_with_three_identifiers(self, resource_group, location @GlobalStorageAccountPreparer() def test_set_container_acl_too_many_ids(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container_name = self._create_container(bsc) # Act @@ -574,7 +574,7 @@ def test_set_container_acl_too_many_ids(self, resource_group, location, storage_ @GlobalStorageAccountPreparer() def test_lease_container_acquire_and_release(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) # Act @@ -585,7 +585,7 @@ def test_lease_container_acquire_and_release(self, resource_group, location, sto @GlobalStorageAccountPreparer() def test_lease_container_renew(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) lease = container.acquire_lease(lease_duration=15) self.sleep(10) @@ -604,7 +604,7 @@ def test_lease_container_renew(self, resource_group, location, storage_account, @GlobalStorageAccountPreparer() def test_lease_container_break_period(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) # Act @@ -618,7 +618,7 @@ def test_lease_container_break_period(self, resource_group, location, storage_ac @GlobalStorageAccountPreparer() def test_lease_container_break_released_lease_fails(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) lease = container.acquire_lease() lease.release() @@ -631,7 +631,7 @@ def test_lease_container_break_released_lease_fails(self, resource_group, locati @GlobalStorageAccountPreparer() def test_lease_container_with_duration(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) # Act @@ -645,7 +645,7 @@ def test_lease_container_with_duration(self, resource_group, location, storage_a @GlobalStorageAccountPreparer() def test_lease_container_twice(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) # Act @@ -657,7 +657,7 @@ def test_lease_container_twice(self, resource_group, location, storage_account, @GlobalStorageAccountPreparer() def test_lease_container_with_proposed_lease_id(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) # Act @@ -669,7 +669,7 @@ def test_lease_container_with_proposed_lease_id(self, resource_group, location, @GlobalStorageAccountPreparer() def test_lease_container_change_lease_id(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) # Act @@ -688,7 +688,7 @@ def test_lease_container_change_lease_id(self, resource_group, location, storage @GlobalStorageAccountPreparer() def test_delete_container_with_existing_container(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) # Act @@ -699,7 +699,7 @@ def test_delete_container_with_existing_container(self, resource_group, location @GlobalStorageAccountPreparer() def test_delete_container_with_non_existing_container_fail_not_exist(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container_name = self._get_container_reference() container = bsc.get_container_client(container_name) @@ -715,7 +715,7 @@ def test_delete_container_with_non_existing_container_fail_not_exist(self, resou @GlobalStorageAccountPreparer() def test_delete_container_with_lease_id(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) lease = container.acquire_lease(lease_duration=15) @@ -729,7 +729,7 @@ def test_delete_container_with_lease_id(self, resource_group, location, storage_ @GlobalStorageAccountPreparer() def test_list_names(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) data = b'hello world' @@ -745,7 +745,7 @@ def test_list_names(self, resource_group, location, storage_account, storage_acc @GlobalStorageAccountPreparer() def test_list_blobs(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) data = b'hello world' container.get_blob_client('blob1').upload_blob(data) @@ -767,7 +767,7 @@ def test_list_blobs(self, resource_group, location, storage_account, storage_acc @GlobalStorageAccountPreparer() def test_list_blobs_leased_blob(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) data = b'hello world' blob1 = container.get_blob_client('blob1') @@ -789,7 +789,7 @@ def test_list_blobs_leased_blob(self, resource_group, location, storage_account, @GlobalStorageAccountPreparer() def test_list_blobs_with_prefix(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) data = b'hello world' container.get_blob_client('blob_a1').upload_blob(data) @@ -807,7 +807,7 @@ def test_list_blobs_with_prefix(self, resource_group, location, storage_account, @GlobalStorageAccountPreparer() def test_list_blobs_with_num_results(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) data = b'hello world' container.get_blob_client('blob_a1').upload_blob(data) @@ -827,7 +827,7 @@ def test_list_blobs_with_num_results(self, resource_group, location, storage_acc @GlobalStorageAccountPreparer() def test_list_blobs_with_include_snapshots(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) data = b'hello world' blob1 = container.get_blob_client('blob1') @@ -849,7 +849,7 @@ 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.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) pytest.skip("Waiting on metadata XML fix in msrest") container = self._create_container(bsc) data = b'hello world' @@ -872,7 +872,7 @@ def test_list_blobs_with_include_metadata(self, resource_group, location, storag @GlobalStorageAccountPreparer() def test_list_blobs_with_include_uncommittedblobs(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) data = b'hello world' blob1 = container.get_blob_client('blob1') @@ -893,7 +893,7 @@ def test_list_blobs_with_include_uncommittedblobs(self, resource_group, location @GlobalStorageAccountPreparer() def test_list_blobs_with_include_copy(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) data = b'hello world' container.get_blob_client('blob1').upload_blob(data, metadata={'status': 'original'}) @@ -930,7 +930,7 @@ def test_list_blobs_with_include_copy(self, resource_group, location, storage_ac @GlobalStorageAccountPreparer() def test_list_blobs_with_delimiter(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) data = b'hello world' @@ -953,7 +953,7 @@ def test_list_blobs_with_delimiter(self, resource_group, location, storage_accou @GlobalStorageAccountPreparer() def test_delete_blobs_simple(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) data = b'hello world' @@ -981,7 +981,7 @@ def test_delete_blobs_simple(self, resource_group, location, storage_account, st @GlobalStorageAccountPreparer() def test_delete_blobs_simple_no_raise(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) data = b'hello world' @@ -1008,7 +1008,7 @@ def test_delete_blobs_simple_no_raise(self, resource_group, location, storage_ac @GlobalStorageAccountPreparer() def test_delete_blobs_snapshot(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) data = b'hello world' @@ -1044,7 +1044,7 @@ def test_delete_blobs_snapshot(self, resource_group, location, storage_account, @pytest.mark.skipif(sys.version_info < (3, 0), reason="Batch not supported on Python 2.7") @GlobalStorageAccountPreparer() def test_standard_blob_tier_set_tier_api_batch(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) tiers = [StandardBlobTier.Archive, StandardBlobTier.Cool, StandardBlobTier.Hot] @@ -1097,7 +1097,7 @@ def test_standard_blob_tier_set_tier_api_batch(self, resource_group, location, s # @pytest.mark.skipif(sys.version_info < (3, 0), reason="Batch not supported on Python 2.7") @GlobalStorageAccountPreparer() def test_premium_tier_set_tier_api_batch(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) url = self._get_premium_account_url() credential = self._get_premium_shared_key_credential() pbs = BlobServiceClient(url, credential=credential) @@ -1146,7 +1146,7 @@ def test_premium_tier_set_tier_api_batch(self, resource_group, location, storage @GlobalStorageAccountPreparer() def test_walk_blobs_with_delimiter(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) data = b'hello world' @@ -1172,7 +1172,7 @@ def recursive_walk(prefix): @GlobalStorageAccountPreparer() def test_list_blobs_with_include_multiple(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) pytest.skip("Waiting on metadata XML fix in msrest") container = self._create_container(bsc) data = b'hello world' @@ -1204,7 +1204,7 @@ def test_list_blobs_with_include_multiple(self, resource_group, location, storag @GlobalStorageAccountPreparer() def test_shared_access_container(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) blob_name = 'blob1' data = b'hello world' @@ -1231,7 +1231,7 @@ def test_shared_access_container(self, resource_group, location, storage_account @GlobalStorageAccountPreparer() def test_web_container_normal_operations_working(self, resource_group, location, storage_account, storage_account_key): web_container = "$web" - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) # create the web container in case it does not exist yet container = bsc.get_container_client(web_container) @@ -1268,7 +1268,7 @@ def test_user_delegation_sas_for_container(self, resource_group, location, stora pytest.skip("Current Framework Cannot Support OAUTH") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) token_credential = self.generate_oauth_token() service_client = BlobServiceClient(self._get_oauth_account_url(), credential=token_credential) user_delegation_key = service_client.get_user_delegation_key(datetime.utcnow(), @@ -1313,7 +1313,7 @@ def test_set_container_permission(self): @GlobalStorageAccountPreparer() def test_download_blob(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) container = self._create_container(bsc) data = b'hello world' blob_name = self.get_resource_name("blob") diff --git a/sdk/storage/azure-storage-blob/tests/test_container_async.py b/sdk/storage/azure-storage-blob/tests/test_container_async.py index 51bed07244c0..4afac4a50ed7 100644 --- a/sdk/storage/azure-storage-blob/tests/test_container_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_container_async.py @@ -82,7 +82,7 @@ async def _to_list(self, async_iterator): @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_create_container(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container_name = self._get_container_reference() # Act @@ -95,7 +95,7 @@ async def test_create_container(self, resource_group, location, storage_account, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_create_cntnr_w_existing_cntnr_fail_on_exist(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container_name = self._get_container_reference() # Act @@ -110,7 +110,7 @@ async def test_create_cntnr_w_existing_cntnr_fail_on_exist(self, resource_group, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_create_container_with_public_access_container(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container_name = self._get_container_reference() # Act @@ -123,7 +123,7 @@ async def test_create_container_with_public_access_container(self, resource_grou @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_create_container_with_public_access_blob(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container_name = self._get_container_reference() # Act @@ -134,7 +134,7 @@ async def test_create_container_with_public_access_blob(self, resource_group, lo await blob.upload_blob(u'xyz') anonymous_service = BlobClient( - self.account_url(storage_account.name, "blob"), + self.account_url(storage_account, "blob"), container_name=container_name, blob_name="blob1") @@ -145,7 +145,7 @@ async def test_create_container_with_public_access_blob(self, resource_group, lo @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_create_container_with_metadata(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container_name = self._get_container_reference() metadata = {'hello': 'world', 'number': '42'} @@ -162,7 +162,7 @@ async def test_create_container_with_metadata(self, resource_group, location, st @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_container_exists_with_lease(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) await container.acquire_lease() @@ -175,7 +175,7 @@ async def test_container_exists_with_lease(self, resource_group, location, stora @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_unicode_create_container_unicode_name(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container_name = u'啊齄丂狛狜' container = bsc.get_container_client(container_name) @@ -189,7 +189,7 @@ async def test_unicode_create_container_unicode_name(self, resource_group, locat @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_list_containers(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) # Act @@ -209,7 +209,7 @@ async def test_list_containers(self, resource_group, location, storage_account, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_list_containers_with_prefix(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) # Act @@ -227,7 +227,7 @@ async def test_list_containers_with_prefix(self, resource_group, location, stora @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_list_containers_with_include_metadata(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) metadata = {'hello': 'world', 'number': '42'} resp = await container.set_container_metadata(metadata) @@ -249,7 +249,7 @@ async def test_list_containers_with_include_metadata(self, resource_group, locat @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_list_containers_with_public_access(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) access_policy = AccessPolicy(permission=ContainerSasPermissions(read=True), expiry=datetime.utcnow() + timedelta(hours=1), @@ -272,7 +272,7 @@ async def test_list_containers_with_public_access(self, resource_group, location @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_list_containers_with_num_results_and_marker(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) prefix = 'listcontainerasync' container_names = [] for i in range(0, 4): @@ -306,7 +306,7 @@ async def test_list_containers_with_num_results_and_marker(self, resource_group, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_container_metadata(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) metadata = {'hello': 'world', 'number': '43'} container = await self._create_container(bsc) @@ -320,7 +320,7 @@ async def test_set_container_metadata(self, resource_group, location, storage_ac @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_container_metadata_with_lease_id(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) metadata = {'hello': 'world', 'number': '43'} container = await self._create_container(bsc) lease_id = await container.acquire_lease() @@ -336,7 +336,7 @@ async def test_set_container_metadata_with_lease_id(self, resource_group, locati @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_container_metadata_with_non_existing_container(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container_name = self._get_container_reference() container = bsc.get_container_client(container_name) @@ -349,7 +349,7 @@ async def test_set_container_metadata_with_non_existing_container(self, resource @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_container_metadata(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) metadata = {'hello': 'world', 'number': '42'} container = await self._create_container(bsc) await container.set_container_metadata(metadata) @@ -364,7 +364,7 @@ async def test_get_container_metadata(self, resource_group, location, storage_ac @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_container_metadata_with_lease_id(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) metadata = {'hello': 'world', 'number': '42'} container = await self._create_container(bsc) await container.set_container_metadata(metadata) @@ -380,7 +380,7 @@ async def test_get_container_metadata_with_lease_id(self, resource_group, locati @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_container_properties(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) metadata = {'hello': 'world', 'number': '42'} container = await self._create_container(bsc) await container.set_container_metadata(metadata) @@ -401,7 +401,7 @@ async def test_get_container_properties(self, resource_group, location, storage_ @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_container_properties_with_lease_id(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) metadata = {'hello': 'world', 'number': '42'} container = await self._create_container(bsc) await container.set_container_metadata(metadata) @@ -421,7 +421,7 @@ async def test_get_container_properties_with_lease_id(self, resource_group, loca @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_container_acl(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) # Act @@ -435,7 +435,7 @@ async def test_get_container_acl(self, resource_group, location, storage_account @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_container_acl_with_lease_id(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) lease_id = await container.acquire_lease() @@ -449,7 +449,7 @@ async def test_get_container_acl_with_lease_id(self, resource_group, location, s @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_container_acl(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) # Act @@ -471,7 +471,7 @@ async def test_set_container_acl(self, resource_group, location, storage_account @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_container_acl_with_one_signed_identifier(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) from dateutil.tz import tzutc container = await self._create_container(bsc) @@ -490,7 +490,7 @@ async def test_set_container_acl_with_one_signed_identifier(self, resource_group @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_container_acl_with_lease_id(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) lease_id = await container.acquire_lease() @@ -509,7 +509,7 @@ async def test_set_container_acl_with_lease_id(self, resource_group, location, s @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_container_acl_with_public_access(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) # Act @@ -527,7 +527,7 @@ async def test_set_container_acl_with_public_access(self, resource_group, locati @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_container_acl_with_empty_signed_identifiers(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) # Act @@ -542,7 +542,7 @@ async def test_set_container_acl_with_empty_signed_identifiers(self, resource_gr @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_container_acl_with_signed_identifiers(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) # Act @@ -561,7 +561,7 @@ async def test_set_container_acl_with_signed_identifiers(self, resource_group, l @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_container_acl_with_empty_identifiers(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) identifiers = {i: None for i in range(0, 3)} @@ -579,7 +579,7 @@ async def test_set_container_acl_with_empty_identifiers(self, resource_group, lo @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_container_acl_with_three_identifiers(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) access_policy = AccessPolicy(permission=ContainerSasPermissions(read=True), expiry=datetime.utcnow() + timedelta(hours=1), @@ -600,7 +600,7 @@ async def test_set_container_acl_with_three_identifiers(self, resource_group, lo @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_container_acl_too_many_ids(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container_name = await self._create_container(bsc) # Act @@ -619,7 +619,7 @@ async def test_set_container_acl_too_many_ids(self, resource_group, location, st @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_lease_container_acquire_and_release(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) # Act @@ -631,7 +631,7 @@ async def test_lease_container_acquire_and_release(self, resource_group, locatio @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_lease_container_renew(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) lease = await container.acquire_lease(lease_duration=15) self.sleep(10) @@ -651,7 +651,7 @@ async def test_lease_container_renew(self, resource_group, location, storage_acc @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_lease_container_break_period(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) # Act @@ -666,7 +666,7 @@ async def test_lease_container_break_period(self, resource_group, location, stor @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_lease_container_break_released_lease_fails(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) lease = await container.acquire_lease() await lease.release() @@ -680,7 +680,7 @@ async def test_lease_container_break_released_lease_fails(self, resource_group, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_lease_container_with_duration(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) # Act @@ -695,7 +695,7 @@ async def test_lease_container_with_duration(self, resource_group, location, sto @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_lease_container_twice(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) # Act @@ -708,7 +708,7 @@ async def test_lease_container_twice(self, resource_group, location, storage_acc @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_lease_container_with_proposed_lease_id(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) # Act @@ -721,7 +721,7 @@ async def test_lease_container_with_proposed_lease_id(self, resource_group, loca @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_lease_container_change_lease_id(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) # Act @@ -741,7 +741,7 @@ async def test_lease_container_change_lease_id(self, resource_group, location, s @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_delete_container_with_existing_container(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) # Act @@ -753,7 +753,7 @@ async def test_delete_container_with_existing_container(self, resource_group, lo @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_delete_cntnr_w_nonexisting_cntnr_fail_not_exist(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container_name = self._get_container_reference() container = bsc.get_container_client(container_name) @@ -768,7 +768,7 @@ async def test_delete_cntnr_w_nonexisting_cntnr_fail_not_exist(self, resource_gr @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_delete_container_with_lease_id(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) lease = await container.acquire_lease(lease_duration=15) @@ -783,7 +783,7 @@ async def test_delete_container_with_lease_id(self, resource_group, location, st @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_list_names(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) data = b'hello world' @@ -801,7 +801,7 @@ async def test_list_names(self, resource_group, location, storage_account, stora @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_list_blobs(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) data = b'hello world' cr0 = container.get_blob_client('blob1') @@ -828,7 +828,7 @@ async def test_list_blobs(self, resource_group, location, storage_account, stora @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_list_blobs_leased_blob(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) data = b'hello world' blob1 = container.get_blob_client('blob1') @@ -852,7 +852,7 @@ async def test_list_blobs_leased_blob(self, resource_group, location, storage_ac @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_list_blobs_with_prefix(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) data = b'hello world' c0 = container.get_blob_client('blob_a1') @@ -876,7 +876,7 @@ async def test_list_blobs_with_prefix(self, resource_group, location, storage_ac @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_list_blobs_with_num_results(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) data = b'hello world' c0 = container.get_blob_client('blob_a1') @@ -903,7 +903,7 @@ async def test_list_blobs_with_num_results(self, resource_group, location, stora @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_list_blobs_with_include_snapshots(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) data = b'hello world' blob1 = container.get_blob_client('blob1') @@ -928,7 +928,7 @@ async def test_list_blobs_with_include_snapshots(self, resource_group, location, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_list_blobs_with_include_metadata(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) data = b'hello world' blob1 = container.get_blob_client('blob1') @@ -954,7 +954,7 @@ async def test_list_blobs_with_include_metadata(self, resource_group, location, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_list_blobs_with_include_uncommittedblobs(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) data = b'hello world' blob1 = container.get_blob_client('blob1') @@ -978,12 +978,12 @@ async def test_list_blobs_with_include_uncommittedblobs(self, resource_group, lo @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_list_blobs_with_include_copy(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) data = b'hello world' await (container.get_blob_client('blob1')).upload_blob(data, metadata={'status': 'original'}) sourceblob = 'https://{0}.blob.core.windows.net/{1}/blob1'.format( - storage_account.name, + storage_account.name, container.container_name) blobcopy = container.get_blob_client('blob1copy') @@ -1018,7 +1018,7 @@ async def test_list_blobs_with_include_copy(self, resource_group, location, stor @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_list_blobs_with_delimiter(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) data = b'hello world' @@ -1047,7 +1047,7 @@ async def test_list_blobs_with_delimiter(self, resource_group, location, storage @AsyncStorageTestCase.await_prepared_test async def test_delete_blobs_simple(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) data = b'hello world' @@ -1074,7 +1074,7 @@ async def test_delete_blobs_simple(self, resource_group, location, storage_accou @AsyncStorageTestCase.await_prepared_test async def test_delete_blobs_simple_no_raise(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) data = b'hello world' @@ -1101,7 +1101,7 @@ async def test_delete_blobs_simple_no_raise(self, resource_group, location, stor @AsyncStorageTestCase.await_prepared_test async def test_delete_blobs_snapshot(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) data = b'hello world' @@ -1137,7 +1137,7 @@ async def test_delete_blobs_snapshot(self, resource_group, location, storage_acc @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_standard_blob_tier_set_tier_api_batch(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) tiers = [StandardBlobTier.Archive, StandardBlobTier.Cool, StandardBlobTier.Hot] @@ -1183,7 +1183,7 @@ async def test_standard_blob_tier_set_tier_api_batch(self, resource_group, locat @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_premium_tier_set_tier_api_batch(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) url = self._get_premium_account_url() credential = self._get_premium_shared_key_credential() pbs = BlobServiceClient(url, credential=credential) @@ -1236,7 +1236,7 @@ async def test_premium_tier_set_tier_api_batch(self, resource_group, location, s @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_walk_blobs_with_delimiter(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) data = b'hello world' @@ -1267,7 +1267,7 @@ async def recursive_walk(prefix): @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_list_blobs_with_include_multiple(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) data = b'hello world' blob1 = container.get_blob_client('blob1') @@ -1302,7 +1302,7 @@ async def test_list_blobs_with_include_multiple(self, resource_group, location, @AsyncStorageTestCase.await_prepared_test async def test_shared_access_container(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) blob_name = 'blob1' data = b'hello world' @@ -1330,7 +1330,7 @@ async def test_shared_access_container(self, resource_group, location, storage_a @AsyncStorageTestCase.await_prepared_test async def test_web_container_normal_operations_working(self, resource_group, location, storage_account, storage_account_key): web_container = "web" - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) # create the web container in case it does not exist yet container = bsc.get_container_client(web_container) @@ -1363,7 +1363,7 @@ async def test_web_container_normal_operations_working(self, resource_group, loc @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_download_blob_async(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) container = await self._create_container(bsc) data = b'hello world' blob_name = self.get_resource_name("blob") diff --git a/sdk/storage/azure-storage-blob/tests/test_cpk.py b/sdk/storage/azure-storage-blob/tests/test_cpk.py index a9e1873fe836..36cfd123f192 100644 --- a/sdk/storage/azure-storage-blob/tests/test_cpk.py +++ b/sdk/storage/azure-storage-blob/tests/test_cpk.py @@ -85,7 +85,7 @@ def test_put_block_and_put_block_list(self, resource_group, location, storage_ac # test chunking functionality by reducing the size of each chunk, # otherwise the tests would take too long to execute bsc = BlobServiceClient( - self.account_url(storage_account.name, "blob"), + self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=1024, max_single_put_size=1024, @@ -130,7 +130,7 @@ def test_create_block_blob_with_chunks(self, resource_group, location, storage_a # test chunking functionality by reducing the size of each chunk, # otherwise the tests would take too long to execute bsc = BlobServiceClient( - self.account_url(storage_account.name, "blob"), + self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=1024, max_single_put_size=1024, @@ -174,7 +174,7 @@ def test_create_block_blob_with_sub_streams(self, resource_group, location, stor # test chunking functionality by reducing the size of each chunk, # otherwise the tests would take too long to execute bsc = BlobServiceClient( - self.account_url(storage_account.name, "blob"), + self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=1024, max_single_put_size=1024, @@ -214,7 +214,7 @@ def test_create_block_blob_with_single_chunk(self, resource_group, location, sto # test chunking functionality by reducing the size of each chunk, # otherwise the tests would take too long to execute bsc = BlobServiceClient( - self.account_url(storage_account.name, "blob"), + self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=1024, max_single_put_size=1024, @@ -252,7 +252,7 @@ def test_put_block_from_url_and_commit_with_cpk(self, resource_group, location, # test chunking functionality by reducing the size of each chunk, # otherwise the tests would take too long to execute bsc = BlobServiceClient( - self.account_url(storage_account.name, "blob"), + self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=1024, max_single_put_size=1024, @@ -323,7 +323,7 @@ def test_append_block(self, resource_group, location, storage_account, storage_a # test chunking functionality by reducing the size of each chunk, # otherwise the tests would take too long to execute bsc = BlobServiceClient( - self.account_url(storage_account.name, "blob"), + self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=1024, max_single_put_size=1024, @@ -360,7 +360,7 @@ def test_append_block_from_url(self, resource_group, location, storage_account, # test chunking functionality by reducing the size of each chunk, # otherwise the tests would take too long to execute bsc = BlobServiceClient( - self.account_url(storage_account.name, "blob"), + self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=1024, max_single_put_size=1024, @@ -416,7 +416,7 @@ def test_create_append_blob_with_chunks(self, resource_group, location, storage_ # test chunking functionality by reducing the size of each chunk, # otherwise the tests would take too long to execute bsc = BlobServiceClient( - self.account_url(storage_account.name, "blob"), + self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=1024, max_single_put_size=1024, @@ -454,7 +454,7 @@ def test_update_page(self, resource_group, location, storage_account, storage_ac # test chunking functionality by reducing the size of each chunk, # otherwise the tests would take too long to execute bsc = BlobServiceClient( - self.account_url(storage_account.name, "blob"), + self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=1024, max_single_put_size=1024, @@ -496,7 +496,7 @@ def test_update_page_from_url(self, resource_group, location, storage_account, s # test chunking functionality by reducing the size of each chunk, # otherwise the tests would take too long to execute bsc = BlobServiceClient( - self.account_url(storage_account.name, "blob"), + self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=1024, max_single_put_size=1024, @@ -556,7 +556,7 @@ def test_create_page_blob_with_chunks(self, resource_group, location, storage_ac # test chunking functionality by reducing the size of each chunk, # otherwise the tests would take too long to execute bsc = BlobServiceClient( - self.account_url(storage_account.name, "blob"), + self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=1024, max_single_put_size=1024, @@ -621,7 +621,7 @@ def test_get_set_blob_metadata(self, resource_group, location, storage_account, # test chunking functionality by reducing the size of each chunk, # otherwise the tests would take too long to execute bsc = BlobServiceClient( - self.account_url(storage_account.name, "blob"), + self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=1024, max_single_put_size=1024, @@ -667,7 +667,7 @@ def test_snapshot_blob(self, resource_group, location, storage_account, storage_ # test chunking functionality by reducing the size of each chunk, # otherwise the tests would take too long to execute bsc = BlobServiceClient( - self.account_url(storage_account.name, "blob"), + self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=1024, max_single_put_size=1024, diff --git a/sdk/storage/azure-storage-blob/tests/test_cpk_async.py b/sdk/storage/azure-storage-blob/tests/test_cpk_async.py index b5545174b4a9..a220dd73f7b7 100644 --- a/sdk/storage/azure-storage-blob/tests/test_cpk_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_cpk_async.py @@ -93,7 +93,7 @@ async def test_put_block_and_put_block_list(self, resource_group, location, stor # test chunking functionality by reducing the size of each chunk, # otherwise the tests would take too long to execute bsc = BlobServiceClient( - self.account_url(storage_account.name, "blob"), + self.account_url(storage_account, "blob"), storage_account_key, max_single_put_size=1024, min_large_block_upload_threshold=1024, @@ -138,7 +138,7 @@ async def test_create_block_blob_with_chunks(self, resource_group, location, sto # parallel operation # Arrange bsc = BlobServiceClient( - self.account_url(storage_account.name, "blob"), + self.account_url(storage_account, "blob"), storage_account_key, max_single_put_size=1024, min_large_block_upload_threshold=1024, @@ -184,7 +184,7 @@ async def test_create_block_blob_with_sub_streams(self, resource_group, location # test chunking functionality by reducing the size of each chunk, # otherwise the tests would take too long to execute bsc = BlobServiceClient( - self.account_url(storage_account.name, "blob"), + self.account_url(storage_account, "blob"), storage_account_key, max_single_put_size=1024, min_large_block_upload_threshold=1024, @@ -225,7 +225,7 @@ async def test_create_block_blob_with_single_chunk(self, resource_group, locatio # test chunking functionality by reducing the size of each chunk, # otherwise the tests would take too long to execute bsc = BlobServiceClient( - self.account_url(storage_account.name, "blob"), + self.account_url(storage_account, "blob"), storage_account_key, max_single_put_size=1024, min_large_block_upload_threshold=1024, @@ -263,7 +263,7 @@ async def test_put_block_from_url_and_commit(self, resource_group, location, sto # test chunking functionality by reducing the size of each chunk, # otherwise the tests would take too long to execute bsc = BlobServiceClient( - self.account_url(storage_account.name, "blob"), + self.account_url(storage_account, "blob"), storage_account_key, max_single_put_size=1024, min_large_block_upload_threshold=1024, @@ -335,7 +335,7 @@ async def test_append_block(self, resource_group, location, storage_account, sto # test chunking functionality by reducing the size of each chunk, # otherwise the tests would take too long to execute bsc = BlobServiceClient( - self.account_url(storage_account.name, "blob"), + self.account_url(storage_account, "blob"), storage_account_key, max_single_put_size=1024, min_large_block_upload_threshold=1024, @@ -373,7 +373,7 @@ async def test_append_block_from_url(self, resource_group, location, storage_acc # test chunking functionality by reducing the size of each chunk, # otherwise the tests would take too long to execute bsc = BlobServiceClient( - self.account_url(storage_account.name, "blob"), + self.account_url(storage_account, "blob"), storage_account_key, max_single_put_size=1024, min_large_block_upload_threshold=1024, @@ -429,7 +429,7 @@ async def test_create_append_blob_with_chunks(self, resource_group, location, st # test chunking functionality by reducing the size of each chunk, # otherwise the tests would take too long to execute bsc = BlobServiceClient( - self.account_url(storage_account.name, "blob"), + self.account_url(storage_account, "blob"), storage_account_key, max_single_put_size=1024, min_large_block_upload_threshold=1024, @@ -467,7 +467,7 @@ async def test_update_page(self, resource_group, location, storage_account, stor # test chunking functionality by reducing the size of each chunk, # otherwise the tests would take too long to execute bsc = BlobServiceClient( - self.account_url(storage_account.name, "blob"), + self.account_url(storage_account, "blob"), storage_account_key, max_single_put_size=1024, min_large_block_upload_threshold=1024, @@ -509,7 +509,7 @@ async def test_update_page_from_url(self, resource_group, location, storage_acco # test chunking functionality by reducing the size of each chunk, # otherwise the tests would take too long to execute bsc = BlobServiceClient( - self.account_url(storage_account.name, "blob"), + self.account_url(storage_account, "blob"), storage_account_key, max_single_put_size=1024, min_large_block_upload_threshold=1024, @@ -568,7 +568,7 @@ async def test_create_page_blob_with_chunks(self, resource_group, location, stor # test chunking functionality by reducing the size of each chunk, # otherwise the tests would take too long to execute bsc = BlobServiceClient( - self.account_url(storage_account.name, "blob"), + self.account_url(storage_account, "blob"), storage_account_key, max_single_put_size=1024, min_large_block_upload_threshold=1024, @@ -608,7 +608,7 @@ async def test_get_set_blob_metadata(self, resource_group, location, storage_acc # test chunking functionality by reducing the size of each chunk, # otherwise the tests would take too long to execute bsc = BlobServiceClient( - self.account_url(storage_account.name, "blob"), + self.account_url(storage_account, "blob"), storage_account_key, max_single_put_size=1024, min_large_block_upload_threshold=1024, @@ -654,7 +654,7 @@ async def test_snapshot_blob(self, resource_group, location, storage_account, st # test chunking functionality by reducing the size of each chunk, # otherwise the tests would take too long to execute bsc = BlobServiceClient( - self.account_url(storage_account.name, "blob"), + self.account_url(storage_account, "blob"), storage_account_key, max_single_put_size=1024, min_large_block_upload_threshold=1024, diff --git a/sdk/storage/azure-storage-blob/tests/test_get_blob.py b/sdk/storage/azure-storage-blob/tests/test_get_blob.py index 35c97a411368..de19b6db4593 100644 --- a/sdk/storage/azure-storage-blob/tests/test_get_blob.py +++ b/sdk/storage/azure-storage-blob/tests/test_get_blob.py @@ -29,12 +29,12 @@ # ------------------------------------------------------------------------------ class StorageGetBlobTest(StorageTestCase): - def _setup(self, name, key): + def _setup(self, storage_account, key): # test chunking functionality by reducing the threshold # for chunking and the size of each chunk, otherwise # the tests would take too long to execute self.bsc = BlobServiceClient( - self.account_url(name, "blob"), + self.account_url(storage_account, "blob"), credential=key, max_single_get_size=1024, max_chunk_get_size=1024) @@ -85,7 +85,7 @@ def seekable(self): @GlobalStorageAccountPreparer() def test_unicode_get_blob_unicode_data(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_data = u'hello world啊齄丂狛狜'.encode('utf-8') blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -100,7 +100,7 @@ def test_unicode_get_blob_unicode_data(self, resource_group, location, storage_a @GlobalStorageAccountPreparer() def test_unicode_get_blob_binary_data(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) base64_data = 'AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/wABAgMEBQYHCAkKCwwNDg8QERITFBUWFxgZGhscHR4fICEiIyQlJicoKSorLC0uLzAxMjM0NTY3ODk6Ozw9Pj9AQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVpbXF1eX2BhYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ent8fX5/gIGCg4SFhoeIiYqLjI2Oj5CRkpOUlZaXmJmam5ydnp+goaKjpKWmp6ipqqusra6vsLGys7S1tre4ubq7vL2+v8DBwsPExcbHyMnKy8zNzs/Q0dLT1NXW19jZ2tvc3d7f4OHi4+Tl5ufo6err7O3u7/Dx8vP09fb3+Pn6+/z9/v8AAQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHyAhIiMkJSYnKCkqKywtLi8wMTIzNDU2Nzg5Ojs8PT4/QEFCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaW1xdXl9gYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXp7fH1+f4CBgoOEhYaHiImKi4yNjo+QkZKTlJWWl5iZmpucnZ6foKGio6SlpqeoqaqrrK2ur7CxsrO0tba3uLm6u7y9vr/AwcLDxMXGx8jJysvMzc7P0NHS09TV1tfY2drb3N3e3+Dh4uPk5ebn6Onq6+zt7u/w8fLz9PX29/j5+vv8/f7/AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w==' binary_data = base64.b64decode(base64_data) @@ -117,7 +117,7 @@ def test_unicode_get_blob_binary_data(self, resource_group, location, storage_ac @GlobalStorageAccountPreparer() def test_get_blob_no_content(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_data = b'' blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -135,7 +135,7 @@ def test_get_blob_no_content(self, resource_group, location, storage_account, st def test_get_blob_to_bytes(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act @@ -149,7 +149,7 @@ def test_get_blob_to_bytes(self, resource_group, location, storage_account, stor def test_ranged_get_blob_to_bytes_with_single_byte(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act @@ -168,7 +168,7 @@ def test_ranged_get_blob_to_bytes_with_single_byte(self, resource_group, locatio @GlobalStorageAccountPreparer() def test_ranged_get_blob_to_bytes_with_zero_byte(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_data = b'' blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -186,7 +186,7 @@ def test_ranged_get_blob_to_bytes_with_zero_byte(self, resource_group, location, @GlobalStorageAccountPreparer() def test_ranged_get_blob_with_missing_start_range(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_data = b'foobar' blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -202,7 +202,7 @@ def test_ranged_get_blob_with_missing_start_range(self, resource_group, location def test_get_blob_to_bytes_snapshot(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) snapshot_ref = blob.create_snapshot() snapshot = self.bsc.get_blob_client(self.container_name, self.byte_blob, snapshot=snapshot_ref) @@ -220,7 +220,7 @@ def test_get_blob_to_bytes_snapshot(self, resource_group, location, storage_acco def test_get_blob_to_bytes_with_progress(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) progress = [] blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) @@ -242,7 +242,7 @@ def callback(response): @GlobalStorageAccountPreparer() def test_get_blob_to_bytes_non_parallel(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) progress = [] blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) @@ -264,7 +264,7 @@ def callback(response): @GlobalStorageAccountPreparer() def test_get_blob_to_bytes_small(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_data = self.get_random_bytes(1024) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -293,7 +293,7 @@ def callback(response): def test_get_blob_to_stream(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act @@ -314,7 +314,7 @@ def test_get_blob_to_stream(self, resource_group, location, storage_account, sto def test_get_blob_to_stream_with_progress(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) progress = [] blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) @@ -342,7 +342,7 @@ def callback(response): @GlobalStorageAccountPreparer() def test_get_blob_to_stream_non_parallel(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) progress = [] blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) @@ -371,7 +371,7 @@ def callback(response): @GlobalStorageAccountPreparer() def test_get_blob_to_stream_small(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_data = self.get_random_bytes(1024) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -408,7 +408,7 @@ def callback(response): def test_ranged_get_blob_to_path(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act @@ -430,7 +430,7 @@ def test_ranged_get_blob_to_path(self, resource_group, location, storage_account def test_ranged_get_blob_to_path_with_progress(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) progress = [] blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) @@ -465,7 +465,7 @@ def callback(response): @GlobalStorageAccountPreparer() def test_ranged_get_blob_to_path_small(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act @@ -483,7 +483,7 @@ def test_ranged_get_blob_to_path_small(self, resource_group, location, storage_a @GlobalStorageAccountPreparer() def test_ranged_get_blob_to_path_non_parallel(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act @@ -504,7 +504,7 @@ def test_ranged_get_blob_to_path_non_parallel(self, resource_group, location, st def test_ranged_get_blob_to_path_invalid_range_parallel(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_size = self.config.max_single_get_size + 1 blob_data = self.get_random_bytes(blob_size) blob_name = self._get_blob_reference() @@ -530,7 +530,7 @@ def test_ranged_get_blob_to_path_invalid_range_parallel(self, resource_group, lo def test_ranged_get_blob_to_path_invalid_range_non_parallel(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_size = 1024 blob_data = self.get_random_bytes(blob_size) blob_name = self._get_blob_reference() @@ -558,7 +558,7 @@ def test_ranged_get_blob_to_path_invalid_range_non_parallel(self, resource_group def test_get_blob_to_text(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) text_blob = self.get_resource_name('textblob') text_data = self.get_random_text_data(self.config.max_single_get_size + 1) blob = self.bsc.get_blob_client(self.container_name, text_blob) @@ -576,7 +576,7 @@ def test_get_blob_to_text(self, resource_group, location, storage_account, stora def test_get_blob_to_text_with_progress(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) text_blob = self.get_resource_name('textblob') text_data = self.get_random_text_data(self.config.max_single_get_size + 1) blob = self.bsc.get_blob_client(self.container_name, text_blob) @@ -606,7 +606,7 @@ def callback(response): @GlobalStorageAccountPreparer() def test_get_blob_to_text_non_parallel(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) text_blob = self._get_blob_reference() text_data = self.get_random_text_data(self.config.max_single_get_size + 1) blob = self.bsc.get_blob_client(self.container_name, text_blob) @@ -636,7 +636,7 @@ def callback(response): @GlobalStorageAccountPreparer() def test_get_blob_to_text_small(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_data = self.get_random_text_data(1024) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -663,7 +663,7 @@ def callback(response): @GlobalStorageAccountPreparer() def test_get_blob_to_text_with_encoding(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) text = u'hello 啊齄丂狛狜 world' blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -678,7 +678,7 @@ def test_get_blob_to_text_with_encoding(self, resource_group, location, storage_ @GlobalStorageAccountPreparer() def test_get_blob_to_text_with_encoding_and_progress(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) text = u'hello 啊齄丂狛狜 world' blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -705,7 +705,7 @@ def callback(response): @GlobalStorageAccountPreparer() def test_get_blob_non_seekable(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act @@ -727,7 +727,7 @@ def test_get_blob_non_seekable(self, resource_group, location, storage_account, def test_get_blob_non_seekable_parallel(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act @@ -742,7 +742,7 @@ def test_get_blob_non_seekable_parallel(self, resource_group, location, storage_ @GlobalStorageAccountPreparer() def test_get_blob_to_stream_exact_get_size(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() byte_data = self.get_random_bytes(self.config.max_single_get_size) blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -774,7 +774,7 @@ def callback(response): @GlobalStorageAccountPreparer() def test_get_blob_exact_get_size(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() byte_data = self.get_random_bytes(self.config.max_single_get_size) blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -803,7 +803,7 @@ def callback(response): def test_get_blob_exact_chunk_size(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() byte_data = self.get_random_bytes( self.config.max_single_get_size + @@ -834,7 +834,7 @@ def callback(response): def test_get_blob_to_stream_with_md5(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act @@ -855,7 +855,7 @@ def test_get_blob_to_stream_with_md5(self, resource_group, location, storage_acc def test_get_blob_with_md5(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act @@ -869,7 +869,7 @@ def test_get_blob_with_md5(self, resource_group, location, storage_account, stor def test_get_blob_range_to_stream_with_overall_md5(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) props = blob.get_blob_properties() props.content_settings.content_md5 = b'MDAwMDAwMDA=' @@ -891,11 +891,11 @@ def test_get_blob_range_to_stream_with_overall_md5(self, resource_group, locatio @GlobalStorageAccountPreparer() def test_get_blob_range_with_overall_md5(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) content = blob.download_blob(offset=0, length=1024, validate_content=True) - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) props = blob.get_blob_properties() props.content_settings.content_md5 = b'MDAwMDAwMDA=' blob.set_http_headers(props.content_settings) @@ -911,11 +911,11 @@ def test_get_blob_range_with_overall_md5(self, resource_group, location, storage @GlobalStorageAccountPreparer() def test_get_blob_range_with_range_md5(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) content = blob.download_blob(offset=0, length=1024, validate_content=True) - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) props = blob.get_blob_properties() props.content_settings.content_md5 = None blob.set_http_headers(props.content_settings) diff --git a/sdk/storage/azure-storage-blob/tests/test_get_blob_async.py b/sdk/storage/azure-storage-blob/tests/test_get_blob_async.py index a90d45a65028..360561f1e198 100644 --- a/sdk/storage/azure-storage-blob/tests/test_get_blob_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_get_blob_async.py @@ -52,9 +52,9 @@ class StorageGetBlobTestAsync(AsyncStorageTestCase): # --Helpers----------------------------------------------------------------- - async def _setup(self, name, key): + async def _setup(self, storage_account, key): self.bsc = BlobServiceClient( - self.account_url(name, "blob"), + self.account_url(storage_account, "blob"), credential=key, max_single_get_size=32 * 1024, max_chunk_get_size=4 * 1024, @@ -102,7 +102,7 @@ def seekable(self): @AsyncStorageTestCase.await_prepared_test async def test_unicode_get_blob_unicode_data_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_data = u'hello world啊齄丂狛狜'.encode('utf-8') blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -119,7 +119,7 @@ async def test_unicode_get_blob_unicode_data_async(self, resource_group, locatio @AsyncStorageTestCase.await_prepared_test async def test_unicode_get_blob_binary_data_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) base64_data = 'AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/wABAgMEBQYHCAkKCwwNDg8QERITFBUWFxgZGhscHR4fICEiIyQlJicoKSorLC0uLzAxMjM0NTY3ODk6Ozw9Pj9AQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVpbXF1eX2BhYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ent8fX5/gIGCg4SFhoeIiYqLjI2Oj5CRkpOUlZaXmJmam5ydnp+goaKjpKWmp6ipqqusra6vsLGys7S1tre4ubq7vL2+v8DBwsPExcbHyMnKy8zNzs/Q0dLT1NXW19jZ2tvc3d7f4OHi4+Tl5ufo6err7O3u7/Dx8vP09fb3+Pn6+/z9/v8AAQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHyAhIiMkJSYnKCkqKywtLi8wMTIzNDU2Nzg5Ojs8PT4/QEFCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaW1xdXl9gYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXp7fH1+f4CBgoOEhYaHiImKi4yNjo+QkZKTlJWWl5iZmpucnZ6foKGio6SlpqeoqaqrrK2ur7CxsrO0tba3uLm6u7y9vr/AwcLDxMXGx8jJysvMzc7P0NHS09TV1tfY2drb3N3e3+Dh4uPk5ebn6Onq6+zt7u/w8fLz9PX29/j5+vv8/f7/AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w==' binary_data = base64.b64decode(base64_data) @@ -138,7 +138,7 @@ async def test_unicode_get_blob_binary_data_async(self, resource_group, location @AsyncStorageTestCase.await_prepared_test async def test_get_blob_no_content_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_data = b'' blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -158,7 +158,7 @@ async def test_get_blob_to_bytes_async(self, resource_group, location, storage_a # parallel tests introduce random order of requests, can only run live # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act @@ -174,7 +174,7 @@ async def test_ranged_get_blob_to_bytes_with_single_byte_async(self, resource_gr # parallel tests introduce random order of requests, can only run live # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act @@ -194,7 +194,7 @@ async def test_ranged_get_blob_to_bytes_with_single_byte_async(self, resource_gr @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_ranged_get_blob_to_bytes_with_zero_byte_async(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_data = b'' blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -213,7 +213,7 @@ async def test_ranged_get_blob_to_bytes_with_zero_byte_async(self, resource_grou @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_ranged_get_blob_with_missing_start_range_async(self, resource_group, location, storage_account, storage_account_key): - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_data = b'foobar' blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -231,7 +231,7 @@ async def test_get_blob_to_bytes_snapshot_async(self, resource_group, location, # parallel tests introduce random order of requests, can only run live # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) snapshot_ref = await blob.create_snapshot() snapshot = self.bsc.get_blob_client(self.container_name, self.byte_blob, snapshot=snapshot_ref) @@ -251,7 +251,7 @@ async def test_get_blob_to_bytes_with_progress_async(self, resource_group, locat # parallel tests introduce random order of requests, can only run live # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) progress = [] blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) @@ -275,7 +275,7 @@ def callback(response): @AsyncStorageTestCase.await_prepared_test async def test_get_blob_to_bytes_non_parallel_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) progress = [] blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) @@ -299,7 +299,7 @@ def callback(response): @AsyncStorageTestCase.await_prepared_test async def test_get_blob_to_bytes_small_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_data = self.get_random_bytes(1024) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -330,7 +330,7 @@ async def test_get_blob_to_stream_async(self, resource_group, location, storage_ # parallel tests introduce random order of requests, can only run live # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act @@ -353,7 +353,7 @@ async def test_get_blob_to_stream_with_progress_async(self, resource_group, loca # parallel tests introduce random order of requests, can only run live # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) progress = [] blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) @@ -383,7 +383,7 @@ def callback(response): @AsyncStorageTestCase.await_prepared_test async def test_get_blob_to_stream_non_parallel_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) progress = [] blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) @@ -414,7 +414,7 @@ def callback(response): @AsyncStorageTestCase.await_prepared_test async def test_get_blob_to_stream_small_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_data = self.get_random_bytes(1024) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -453,7 +453,7 @@ async def test_ranged_get_blob_to_path_async(self, resource_group, location, sto # parallel tests introduce random order of requests, can only run live # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act @@ -477,7 +477,7 @@ async def test_ranged_get_blob_to_path_with_progress_async(self, resource_group, # parallel tests introduce random order of requests, can only run live # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) progress = [] blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) @@ -514,7 +514,7 @@ def callback(response): @AsyncStorageTestCase.await_prepared_test async def test_ranged_get_blob_to_path_small_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act @@ -534,7 +534,7 @@ async def test_ranged_get_blob_to_path_small_async(self, resource_group, locatio @AsyncStorageTestCase.await_prepared_test async def test_ranged_get_blob_to_path_non_parallel_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act @@ -557,7 +557,7 @@ async def test_ranged_get_blob_to_path_invalid_range_parallel_async(self, resour # parallel tests introduce random order of requests, can only run live # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_size = self.config.max_single_get_size + 1 blob_data = self.get_random_bytes(blob_size) blob_name = self._get_blob_reference() @@ -585,7 +585,7 @@ async def test_ranged_get_blob_to_path_invalid_range_non_parallel_async(self, re # parallel tests introduce random order of requests, can only run live # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_size = 1024 blob_data = self.get_random_bytes(blob_size) blob_name = self._get_blob_reference() @@ -614,7 +614,7 @@ async def test_get_blob_to_text_async(self, resource_group, location, storage_ac # parallel tests introduce random order of requests, can only run live # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) text_blob = self.get_resource_name('textblob') text_data = self.get_random_text_data(self.config.max_single_get_size + 1) blob = self.bsc.get_blob_client(self.container_name, text_blob) @@ -634,7 +634,7 @@ async def test_get_blob_to_text_with_progress_async(self, resource_group, locati # parallel tests introduce random order of requests, can only run live # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) text_blob = self.get_resource_name('textblob') text_data = self.get_random_text_data(self.config.max_single_get_size + 1) blob = self.bsc.get_blob_client(self.container_name, text_blob) @@ -666,7 +666,7 @@ def callback(response): @AsyncStorageTestCase.await_prepared_test async def test_get_blob_to_text_non_parallel_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) text_blob = self._get_blob_reference() text_data = self.get_random_text_data(self.config.max_single_get_size + 1) blob = self.bsc.get_blob_client(self.container_name, text_blob) @@ -698,7 +698,7 @@ def callback(response): @AsyncStorageTestCase.await_prepared_test async def test_get_blob_to_text_small_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_data = self.get_random_text_data(1024) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -727,7 +727,7 @@ def callback(response): @AsyncStorageTestCase.await_prepared_test async def test_get_blob_to_text_with_encoding_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) text = u'hello 啊齄丂狛狜 world' blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -744,7 +744,7 @@ async def test_get_blob_to_text_with_encoding_async(self, resource_group, locati @AsyncStorageTestCase.await_prepared_test async def test_get_blob_to_text_with_encoding_and_progress_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) text = u'hello 啊齄丂狛狜 world' blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -773,7 +773,7 @@ def callback(response): @AsyncStorageTestCase.await_prepared_test async def test_get_blob_non_seekable_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act @@ -797,7 +797,7 @@ async def test_get_blob_non_seekable_parallel_async(self, resource_group, locati # parallel tests introduce random order of requests, can only run live # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act @@ -814,7 +814,7 @@ async def test_get_blob_non_seekable_parallel_async(self, resource_group, locati @AsyncStorageTestCase.await_prepared_test async def test_get_blob_to_stream_exact_get_size_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() byte_data = self.get_random_bytes(self.config.max_single_get_size) blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -848,7 +848,7 @@ def callback(response): @AsyncStorageTestCase.await_prepared_test async def test_get_blob_exact_get_size_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() byte_data = self.get_random_bytes(self.config.max_single_get_size) blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -879,7 +879,7 @@ async def test_get_blob_exact_chunk_size_async(self, resource_group, location, s # parallel tests introduce random order of requests, can only run live # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() byte_data = self.get_random_bytes( self.config.max_single_get_size + @@ -912,7 +912,7 @@ async def test_get_blob_to_stream_with_md5_async(self, resource_group, location, # parallel tests introduce random order of requests, can only run live # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act @@ -935,7 +935,7 @@ async def test_get_blob_with_md5_async(self, resource_group, location, storage_a # parallel tests introduce random order of requests, can only run live # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act @@ -951,7 +951,7 @@ async def test_get_blob_range_to_stream_with_overall_md5_async(self, resource_gr # parallel tests introduce random order of requests, can only run live # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) props = await blob.get_blob_properties() props.content_settings.content_md5 = b'MDAwMDAwMDA=' @@ -975,7 +975,7 @@ async def test_get_blob_range_to_stream_with_overall_md5_async(self, resource_gr async def test_get_blob_range_with_overall_md5_async(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) content = await blob.download_blob(offset=0, length=1024, validate_content=True) @@ -996,7 +996,7 @@ async def test_get_blob_range_with_overall_md5_async(self, resource_group, locat async def test_get_blob_range_with_range_md5_async(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) content = await blob.download_blob(offset=0, length=1024, validate_content=True) diff --git a/sdk/storage/azure-storage-blob/tests/test_large_block_blob.py b/sdk/storage/azure-storage-blob/tests/test_large_block_blob.py index a819ac2c124b..79817d675260 100644 --- a/sdk/storage/azure-storage-blob/tests/test_large_block_blob.py +++ b/sdk/storage/azure-storage-blob/tests/test_large_block_blob.py @@ -37,12 +37,12 @@ pytest.skip("Skip tests for Pypy", allow_module_level=True) class StorageLargeBlockBlobTest(StorageTestCase): - def _setup(self, name, key): + def _setup(self, storage_account, key): # test chunking functionality by reducing the threshold # for chunking and the size of each chunk, otherwise # the tests would take too long to execute self.bsc = BlobServiceClient( - self.account_url(name, "blob"), + self.account_url(storage_account, "blob"), credential=key, max_single_put_size=32 * 1024, max_block_size=2 * 1024 * 1024, @@ -80,7 +80,7 @@ def assertBlobEqual(self, container_name, blob_name, expected_data): @GlobalStorageAccountPreparer() def test_put_block_bytes_large(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob = self._create_blob() # Act @@ -95,7 +95,7 @@ def test_put_block_bytes_large(self, resource_group, location, storage_account, @GlobalStorageAccountPreparer() def test_put_block_bytes_large_with_md5(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob = self._create_blob() # Act @@ -110,7 +110,7 @@ def test_put_block_bytes_large_with_md5(self, resource_group, location, storage_ @GlobalStorageAccountPreparer() def test_put_block_stream_large(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob = self._create_blob() # Act @@ -128,7 +128,7 @@ def test_put_block_stream_large(self, resource_group, location, storage_account, @GlobalStorageAccountPreparer() def test_put_block_stream_large_with_md5(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob = self._create_blob() # Act @@ -148,7 +148,7 @@ def test_put_block_stream_large_with_md5(self, resource_group, location, storage def test_create_large_blob_from_path(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) @@ -169,7 +169,7 @@ def test_create_large_blob_from_path(self, resource_group, location, storage_acc def test_create_large_blob_from_path_with_md5(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) @@ -189,7 +189,7 @@ def test_create_large_blob_from_path_with_md5(self, resource_group, location, st @GlobalStorageAccountPreparer() def test_create_large_blob_from_path_non_parallel(self, resource_group, location, storage_account, storage_account_key): - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(self.get_random_bytes(100)) @@ -210,7 +210,7 @@ def test_create_large_blob_from_path_non_parallel(self, resource_group, location def test_create_large_blob_from_path_with_progress(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) @@ -239,7 +239,7 @@ def callback(response): def test_create_large_blob_from_path_with_properties(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) @@ -266,7 +266,7 @@ def test_create_large_blob_from_path_with_properties(self, resource_group, locat def test_create_large_blob_from_stream_chunked_upload(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) @@ -287,7 +287,7 @@ def test_create_large_blob_from_stream_chunked_upload(self, resource_group, loca def test_creat_lrgblob_frm_stream_w_progress_chnkd_upload(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) @@ -315,7 +315,7 @@ def callback(response): @GlobalStorageAccountPreparer() def test_create_large_blob_from_stream_chunked_upload_with_count(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) @@ -337,7 +337,7 @@ def test_create_large_blob_from_stream_chunked_upload_with_count(self, resource_ def test_creat_lrgblob_frm_strm_chnkd_uplod_w_count_n_props(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) @@ -366,7 +366,7 @@ def test_creat_lrgblob_frm_strm_chnkd_uplod_w_count_n_props(self, resource_group def test_creat_lrg_blob_frm_stream_chnked_upload_w_props(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - self._setup(storage_account.name, storage_account_key) + self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) diff --git a/sdk/storage/azure-storage-blob/tests/test_large_block_blob_async.py b/sdk/storage/azure-storage-blob/tests/test_large_block_blob_async.py index 90ff42c1bee4..3c9d19bccbea 100644 --- a/sdk/storage/azure-storage-blob/tests/test_large_block_blob_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_large_block_blob_async.py @@ -54,12 +54,12 @@ async def send(self, request, **config): class StorageLargeBlockBlobTestAsync(AsyncStorageTestCase): # --Helpers----------------------------------------------------------------- - async def _setup(self, name, key): + async def _setup(self, storage_account, key): # test chunking functionality by reducing the threshold # for chunking and the size of each chunk, otherwise # the tests would take too long to execute self.bsc = BlobServiceClient( - self.account_url(name, "blob"), + self.account_url(storage_account, "blob"), credential=key, max_single_put_size=32 * 1024, max_block_size=2 * 1024 * 1024, @@ -104,7 +104,7 @@ async def assertBlobEqual(self, container_name, blob_name, expected_data): @AsyncStorageTestCase.await_prepared_test async def test_put_block_bytes_large_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob = await self._create_blob() # Act @@ -122,7 +122,7 @@ async def test_put_block_bytes_large_async(self, resource_group, location, stora @AsyncStorageTestCase.await_prepared_test async def test_put_block_bytes_large_with_md5_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob = await self._create_blob() # Act @@ -138,7 +138,7 @@ async def test_put_block_bytes_large_with_md5_async(self, resource_group, locati @AsyncStorageTestCase.await_prepared_test async def test_put_block_stream_large_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob = await self._create_blob() # Act @@ -157,7 +157,7 @@ async def test_put_block_stream_large_async(self, resource_group, location, stor @AsyncStorageTestCase.await_prepared_test async def test_put_block_stream_large_with_md5_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob = await self._create_blob() # Act @@ -179,7 +179,7 @@ async def test_create_large_blob_from_path_async(self, resource_group, location, # parallel tests introduce random order of requests, can only run live # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) @@ -204,7 +204,7 @@ async def test_create_large_blob_from_path_with_md5_async(self, resource_group, # parallel tests introduce random order of requests, can only run live # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) @@ -228,7 +228,7 @@ async def test_create_large_blob_from_path_with_md5_async(self, resource_group, async def test_create_large_blob_from_path_non_parallel_async(self, resource_group, location, storage_account, storage_account_key): # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(self.get_random_bytes(100)) @@ -253,7 +253,7 @@ async def test_create_large_blob_from_path_with_progress_async(self, resource_gr # parallel tests introduce random order of requests, can only run live # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) FILE_PATH = 'large_blob_from_path_with_progress_asyn.temp.{}.dat'.format(str(uuid.uuid4())) @@ -286,7 +286,7 @@ async def test_create_large_blob_from_path_with_properties_async(self, resource_ # parallel tests introduce random order of requests, can only run live # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) @@ -317,7 +317,7 @@ async def test_creat_lrg_blob_frm_stream_chnkd_upload_async(self, resource_group # parallel tests introduce random order of requests, can only run live # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) @@ -342,7 +342,7 @@ async def test_creat_lrgblob_frm_strm_w_prgrss_chnkduplod_async(self, resource_g # parallel tests introduce random order of requests, can only run live # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) @@ -375,7 +375,7 @@ async def test_creat_lrgblob_frm_strm_chnkd_uplod_w_cnt_async(self, resource_gro # parallel tests introduce random order of requests, can only run live # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) @@ -401,7 +401,7 @@ async def test_creat_lrg_frm_stream_chnk_upload_w_cntnprops(self, resource_group # parallel tests introduce random order of requests, can only run live # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) @@ -434,7 +434,7 @@ async def test_create_large_from_stream_chunk_upld_with_props(self, resource_gro # parallel tests introduce random order of requests, can only run live # Arrange - await self._setup(storage_account.name, storage_account_key) + await self._setup(storage_account, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) diff --git a/sdk/storage/azure-storage-blob/tests/test_logging.py b/sdk/storage/azure-storage-blob/tests/test_logging.py index 0829270e3e58..8649ec01b97d 100644 --- a/sdk/storage/azure-storage-blob/tests/test_logging.py +++ b/sdk/storage/azure-storage-blob/tests/test_logging.py @@ -65,7 +65,7 @@ def _setup(self, bsc): @GlobalStorageAccountPreparer() def test_authorization_is_scrubbed_off(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) self._setup(bsc) container = bsc.get_container_client(self.container_name) # Act @@ -82,7 +82,7 @@ def test_authorization_is_scrubbed_off(self, resource_group, location, storage_a @GlobalStorageAccountPreparer() def test_sas_signature_is_scrubbed_off(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) self._setup(bsc) # Arrange container = bsc.get_container_client(self.container_name) @@ -113,7 +113,7 @@ def test_sas_signature_is_scrubbed_off(self, resource_group, location, storage_a @GlobalStorageAccountPreparer() def test_copy_source_sas_is_scrubbed_off(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) self._setup(bsc) # Arrange dest_blob_name = self.get_resource_name('destblob') diff --git a/sdk/storage/azure-storage-blob/tests/test_logging_async.py b/sdk/storage/azure-storage-blob/tests/test_logging_async.py index 34495950c862..20ea907b809b 100644 --- a/sdk/storage/azure-storage-blob/tests/test_logging_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_logging_async.py @@ -86,7 +86,7 @@ async def _setup(self, bsc): @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_authorization_is_scrubbed_off(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, transport=AiohttpTestTransport()) await self._setup(bsc) # Arrange container = bsc.get_container_client(self.container_name) @@ -106,7 +106,7 @@ async def test_authorization_is_scrubbed_off(self, resource_group, location, sto async def test_sas_signature_is_scrubbed_off(self, resource_group, location, storage_account, storage_account_key): # Test can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) await self._setup(bsc) # Arrange container = bsc.get_container_client(self.container_name) @@ -138,7 +138,7 @@ async def test_sas_signature_is_scrubbed_off(self, resource_group, location, sto @AsyncStorageTestCase.await_prepared_test async def test_copy_source_sas_is_scrubbed_off(self, resource_group, location, storage_account, storage_account_key): # Test can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key) await self._setup(bsc) # Arrange dest_blob_name = self.get_resource_name('destblob') diff --git a/sdk/storage/azure-storage-blob/tests/test_page_blob.py b/sdk/storage/azure-storage-blob/tests/test_page_blob.py index dbf9573c034f..13b41d4dd024 100644 --- a/sdk/storage/azure-storage-blob/tests/test_page_blob.py +++ b/sdk/storage/azure-storage-blob/tests/test_page_blob.py @@ -117,7 +117,7 @@ def read(self, count): #--Test cases for page blobs -------------------------------------------- @GlobalStorageAccountPreparer() def test_create_blob(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) @@ -131,7 +131,7 @@ def test_create_blob(self, resource_group, location, storage_account, storage_ac @GlobalStorageAccountPreparer() def test_create_blob_with_metadata(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) metadata = {'hello': 'world', 'number': '42'} @@ -145,7 +145,7 @@ def test_create_blob_with_metadata(self, resource_group, location, storage_accou @GlobalStorageAccountPreparer() def test_put_page_with_lease_id(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) lease = blob.acquire_lease() @@ -160,7 +160,7 @@ def test_put_page_with_lease_id(self, resource_group, location, storage_account, @GlobalStorageAccountPreparer() def test_update_page(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) @@ -176,7 +176,7 @@ def test_update_page(self, resource_group, location, storage_account, storage_ac @GlobalStorageAccountPreparer() def test_create_8tb_blob(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) @@ -194,7 +194,7 @@ def test_create_8tb_blob(self, resource_group, location, storage_account, storag @GlobalStorageAccountPreparer() def test_create_larger_than_8tb_blob_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) @@ -204,7 +204,7 @@ def test_create_larger_than_8tb_blob_fail(self, resource_group, location, storag @GlobalStorageAccountPreparer() def test_update_8tb_blob_page(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) blob.create_page_blob(EIGHT_TB) @@ -229,7 +229,7 @@ def test_update_8tb_blob_page(self, resource_group, location, storage_account, s @GlobalStorageAccountPreparer() def test_update_page_with_md5(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) @@ -241,7 +241,7 @@ def test_update_page_with_md5(self, resource_group, location, storage_account, s @GlobalStorageAccountPreparer() def test_clear_page(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) @@ -256,7 +256,7 @@ def test_clear_page(self, resource_group, location, storage_account, storage_acc @GlobalStorageAccountPreparer() def test_put_page_if_sequence_number_lt_success(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(512) @@ -272,7 +272,7 @@ def test_put_page_if_sequence_number_lt_success(self, resource_group, location, @GlobalStorageAccountPreparer() def test_update_page_if_sequence_number_lt_failure(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(512) @@ -287,7 +287,7 @@ def test_update_page_if_sequence_number_lt_failure(self, resource_group, locatio @GlobalStorageAccountPreparer() def test_update_page_if_sequence_number_lte_success(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(512) @@ -302,7 +302,7 @@ def test_update_page_if_sequence_number_lte_success(self, resource_group, locati @GlobalStorageAccountPreparer() def test_update_page_if_sequence_number_lte_failure(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(512) @@ -317,7 +317,7 @@ def test_update_page_if_sequence_number_lte_failure(self, resource_group, locati @GlobalStorageAccountPreparer() def test_update_page_if_sequence_number_eq_success(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(512) @@ -332,7 +332,7 @@ def test_update_page_if_sequence_number_eq_success(self, resource_group, locatio @GlobalStorageAccountPreparer() def test_update_page_if_sequence_number_eq_failure(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(512) @@ -345,7 +345,7 @@ def test_update_page_if_sequence_number_eq_failure(self, resource_group, locatio @GlobalStorageAccountPreparer() def test_update_page_unicode(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) @@ -360,7 +360,7 @@ def test_update_page_unicode(self, resource_group, location, storage_account, st @GlobalStorageAccountPreparer() def test_upload_pages_from_url(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) source_blob_client = self._create_source_blob(bsc, source_blob_data, 0, SOURCE_BLOB_SIZE) @@ -397,7 +397,7 @@ def test_upload_pages_from_url(self, resource_group, location, storage_account, @GlobalStorageAccountPreparer() def test_upload_pages_from_url_and_validate_content_md5(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) source_blob_client = self._create_source_blob(bsc, source_blob_data, 0, SOURCE_BLOB_SIZE) @@ -440,7 +440,7 @@ def test_upload_pages_from_url_and_validate_content_md5(self, resource_group, lo @GlobalStorageAccountPreparer() def test_upload_pages_from_url_with_source_if_modified(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) source_blob_client = self._create_source_blob(bsc, source_blob_data, 0, SOURCE_BLOB_SIZE) @@ -485,7 +485,7 @@ def test_upload_pages_from_url_with_source_if_modified(self, resource_group, loc @GlobalStorageAccountPreparer() def test_upload_pages_from_url_with_source_if_unmodified(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) source_blob_client = self._create_source_blob(bsc, source_blob_data, 0, SOURCE_BLOB_SIZE) @@ -529,7 +529,7 @@ def test_upload_pages_from_url_with_source_if_unmodified(self, resource_group, l @GlobalStorageAccountPreparer() def test_upload_pages_from_url_with_source_if_match(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) source_blob_client = self._create_source_blob(bsc, source_blob_data, 0, SOURCE_BLOB_SIZE) @@ -574,7 +574,7 @@ def test_upload_pages_from_url_with_source_if_match(self, resource_group, locati @GlobalStorageAccountPreparer() def test_upload_pages_from_url_with_source_if_none_match(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) source_blob_client = self._create_source_blob(bsc, source_blob_data, 0, SOURCE_BLOB_SIZE) @@ -619,7 +619,7 @@ def test_upload_pages_from_url_with_source_if_none_match(self, resource_group, l @GlobalStorageAccountPreparer() def test_upload_pages_from_url_with_if_modified(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) source_blob_client = self._create_source_blob(bsc, source_blob_data, 0, SOURCE_BLOB_SIZE) @@ -663,7 +663,7 @@ def test_upload_pages_from_url_with_if_modified(self, resource_group, location, @GlobalStorageAccountPreparer() def test_upload_pages_from_url_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) source_blob_client = self._create_source_blob(bsc, source_blob_data, 0, SOURCE_BLOB_SIZE) @@ -708,7 +708,7 @@ def test_upload_pages_from_url_with_if_unmodified(self, resource_group, location @GlobalStorageAccountPreparer() def test_upload_pages_from_url_with_if_match(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) source_blob_client = self._create_source_blob(bsc, source_blob_data, 0, SOURCE_BLOB_SIZE) @@ -748,7 +748,7 @@ def test_upload_pages_from_url_with_if_match(self, resource_group, location, sto @GlobalStorageAccountPreparer() def test_upload_pages_from_url_with_if_none_match(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) source_blob_client = self._create_source_blob(bsc, source_blob_data, 0, SOURCE_BLOB_SIZE) @@ -793,7 +793,7 @@ def test_upload_pages_from_url_with_if_none_match(self, resource_group, location @GlobalStorageAccountPreparer() def test_upload_pages_from_url_with_sequence_number_lt(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) start_sequence = 10 source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) @@ -836,7 +836,7 @@ def test_upload_pages_from_url_with_sequence_number_lt(self, resource_group, loc @GlobalStorageAccountPreparer() def test_upload_pages_from_url_with_sequence_number_lte(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) start_sequence = 10 source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) @@ -879,7 +879,7 @@ def test_upload_pages_from_url_with_sequence_number_lte(self, resource_group, lo @GlobalStorageAccountPreparer() def test_upload_pages_from_url_with_sequence_number_eq(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) start_sequence = 10 source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) @@ -921,7 +921,7 @@ def test_upload_pages_from_url_with_sequence_number_eq(self, resource_group, loc @GlobalStorageAccountPreparer() def test_get_page_ranges_no_pages(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) @@ -935,7 +935,7 @@ def test_get_page_ranges_no_pages(self, resource_group, location, storage_accoun @GlobalStorageAccountPreparer() def test_get_page_ranges_2_pages(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc, length=2048) data = self.get_random_bytes(512) @@ -956,7 +956,7 @@ def test_get_page_ranges_2_pages(self, resource_group, location, storage_account @GlobalStorageAccountPreparer() def test_get_page_ranges_diff(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc, length=2048) data = self.get_random_bytes(1536) @@ -992,7 +992,7 @@ def test_get_page_ranges_diff(self, resource_group, location, storage_account, s @GlobalStorageAccountPreparer() def test_update_page_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc, length=2048) data = self.get_random_bytes(512) @@ -1007,7 +1007,7 @@ def test_update_page_fail(self, resource_group, location, storage_account, stora @GlobalStorageAccountPreparer() def test_resize_blob(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc, length=1024) @@ -1024,7 +1024,7 @@ def test_resize_blob(self, resource_group, location, storage_account, storage_ac @GlobalStorageAccountPreparer() def test_set_sequence_number_blob(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) @@ -1041,7 +1041,7 @@ def test_set_sequence_number_blob(self, resource_group, location, storage_accoun @GlobalStorageAccountPreparer() def test_create_page_blob_with_no_overwrite(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data1 = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1073,7 +1073,7 @@ def test_create_page_blob_with_no_overwrite(self, resource_group, location, stor @GlobalStorageAccountPreparer() def test_create_page_blob_with_overwrite(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data1 = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1106,7 +1106,7 @@ def test_create_page_blob_with_overwrite(self, resource_group, location, storage def test_create_blob_from_bytes(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1125,7 +1125,7 @@ def test_create_blob_from_bytes(self, resource_group, location, storage_account, def test_create_blob_from_0_bytes(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(0) @@ -1144,7 +1144,7 @@ def test_create_blob_from_0_bytes(self, resource_group, location, storage_accoun def test_create_blob_from_bytes_with_progress_first(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1172,7 +1172,7 @@ def callback(response): def test_create_blob_from_bytes_with_index(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1186,7 +1186,7 @@ def test_create_blob_from_bytes_with_index(self, resource_group, location, stora @GlobalStorageAccountPreparer() def test_create_blob_from_bytes_with_index_and_count(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1207,7 +1207,7 @@ def test_create_blob_from_bytes_with_index_and_count(self, resource_group, locat def test_create_blob_from_path(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1231,7 +1231,7 @@ def test_create_blob_from_path(self, resource_group, location, storage_account, def test_create_blob_from_path_with_progress(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1260,7 +1260,7 @@ def callback(response): def test_create_blob_from_stream(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1285,7 +1285,7 @@ def test_create_blob_from_stream(self, resource_group, location, storage_account def test_create_blob_from_stream_with_empty_pages(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) # data is almost all empty (0s) except two ranges blob = self._get_blob_reference(bsc) @@ -1320,7 +1320,7 @@ def test_create_blob_from_stream_with_empty_pages(self, resource_group, location def test_create_blob_from_stream_non_seekable(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1347,7 +1347,7 @@ def test_create_blob_from_stream_non_seekable(self, resource_group, location, st def test_create_blob_from_stream_with_progress(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1378,7 +1378,7 @@ def callback(response): def test_create_blob_from_stream_truncated(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1400,7 +1400,7 @@ def test_create_blob_from_stream_truncated(self, resource_group, location, stora def test_create_blob_from_stream_with_progress_truncated(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1428,7 +1428,7 @@ def callback(response): @GlobalStorageAccountPreparer() def test_create_blob_with_md5_small(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(512) @@ -1443,7 +1443,7 @@ def test_create_blob_with_md5_small(self, resource_group, location, storage_acco def test_create_blob_with_md5_large(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1458,7 +1458,7 @@ def test_create_blob_with_md5_large(self, resource_group, location, storage_acco def test_incremental_copy_blob(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) source_blob = self._create_blob(bsc, length=2048) data = self.get_random_bytes(512) @@ -1499,9 +1499,9 @@ def test_incremental_copy_blob(self, resource_group, location, storage_account, @GlobalResourceGroupPreparer() @StorageAccountPreparer(random_name_enabled=True, sku='premium_LRS', name_prefix='pyacrstorage') def test_blob_tier_on_create(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) - url = self.account_url(storage_account.name, "blob") + url = self.account_url(storage_account, "blob") credential = storage_account_key pbs = BlobServiceClient(url, credential=credential) @@ -1558,9 +1558,9 @@ def test_blob_tier_on_create(self, resource_group, location, storage_account, st @GlobalResourceGroupPreparer() @StorageAccountPreparer(random_name_enabled=True, sku='premium_LRS', name_prefix='pyacrstorage') def test_blob_tier_set_tier_api(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) - url = self.account_url(storage_account.name, "blob") + url = self.account_url(storage_account, "blob") credential = storage_account_key pbs = BlobServiceClient(url, credential=credential) @@ -1612,9 +1612,9 @@ def test_blob_tier_set_tier_api(self, resource_group, location, storage_account, @GlobalResourceGroupPreparer() @StorageAccountPreparer(random_name_enabled=True, sku='premium_LRS', name_prefix='pyacrstorage') def test_blob_tier_copy_blob(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) - url = self.account_url(storage_account.name, "blob") + url = self.account_url(storage_account, "blob") credential = storage_account_key pbs = BlobServiceClient(url, credential=credential) @@ -1635,7 +1635,7 @@ def test_blob_tier_copy_blob(self, resource_group, location, storage_account, st # Act source_blob_url = '{0}/{1}/{2}'.format( - self.account_url(storage_account.name, "blob"), container_name, source_blob.blob_name) + self.account_url(storage_account, "blob"), container_name, source_blob.blob_name) copy_blob = pbs.get_blob_client(container_name, 'blob1copy') copy = copy_blob.start_copy_from_url(source_blob_url, premium_page_blob_tier=PremiumPageBlobTier.P30) @@ -1654,7 +1654,7 @@ def test_blob_tier_copy_blob(self, resource_group, location, storage_account, st source_blob2.create_page_blob(1024) source_blob2_url = '{0}/{1}/{2}'.format( - self.account_url(storage_account.name, "blob"), source_blob2.container_name, source_blob2.blob_name) + self.account_url(storage_account, "blob"), source_blob2.container_name, source_blob2.blob_name) copy_blob2 = pbs.get_blob_client(container_name, 'blob2copy') copy2 = copy_blob2.start_copy_from_url(source_blob2_url, premium_page_blob_tier=PremiumPageBlobTier.P60) @@ -1681,7 +1681,7 @@ def test_blob_tier_copy_blob(self, resource_group, location, storage_account, st @GlobalStorageAccountPreparer() def test_download_sparse_page_blob_non_parallel(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) self.config.max_single_get_size = 4*1024 self.config.max_chunk_get_size = 1024 @@ -1719,7 +1719,7 @@ def test_download_sparse_page_blob_parallel(self, resource_group, location, stor # parallel tests introduce random order of requests, can only run live # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024) self._setup(bsc) self.config.max_single_get_size = 4 * 1024 self.config.max_chunk_get_size = 1024 diff --git a/sdk/storage/azure-storage-blob/tests/test_page_blob_async.py b/sdk/storage/azure-storage-blob/tests/test_page_blob_async.py index d25b8e5b4e8f..4778e7a88d8c 100644 --- a/sdk/storage/azure-storage-blob/tests/test_page_blob_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_page_blob_async.py @@ -142,7 +142,7 @@ def read(self, count): @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_create_blob(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = self._get_blob_reference(bsc) @@ -157,7 +157,7 @@ async def test_create_blob(self, resource_group, location, storage_account, stor @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_create_blob_with_metadata(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) # Arrange await self._setup(bsc) blob = self._get_blob_reference(bsc) @@ -173,7 +173,7 @@ async def test_create_blob_with_metadata(self, resource_group, location, storage @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_put_page_with_lease_id(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) lease = await blob.acquire_lease() @@ -190,7 +190,7 @@ async def test_put_page_with_lease_id(self, resource_group, location, storage_ac @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_update_page(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -207,7 +207,7 @@ async def test_update_page(self, resource_group, location, storage_account, stor @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_create_8tb_blob(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = self._get_blob_reference(bsc) @@ -226,7 +226,7 @@ async def test_create_8tb_blob(self, resource_group, location, storage_account, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_create_larger_than_8tb_blob_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = self._get_blob_reference(bsc) @@ -237,7 +237,7 @@ async def test_create_larger_than_8tb_blob_fail(self, resource_group, location, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_update_8tb_blob_page(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = self._get_blob_reference(bsc) await blob.create_page_blob(EIGHT_TB) @@ -263,7 +263,7 @@ async def test_update_8tb_blob_page(self, resource_group, location, storage_acco @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_update_page_with_md5(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -275,7 +275,7 @@ async def test_update_page_with_md5(self, resource_group, location, storage_acco @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_clear_page(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -290,7 +290,7 @@ async def test_clear_page(self, resource_group, location, storage_account, stora @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_put_page_if_sequence_number_lt_success(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(512) @@ -307,7 +307,7 @@ async def test_put_page_if_sequence_number_lt_success(self, resource_group, loca @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_update_page_if_sequence_number_lt_failure(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(512) @@ -323,7 +323,7 @@ async def test_update_page_if_sequence_number_lt_failure(self, resource_group, l @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_update_page_if_sequence_number_lte_success(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(512) @@ -339,7 +339,7 @@ async def test_update_page_if_sequence_number_lte_success(self, resource_group, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_update_page_if_sequence_number_lte_failure(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(512) @@ -355,7 +355,7 @@ async def test_update_page_if_sequence_number_lte_failure(self, resource_group, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_update_page_if_sequence_number_eq_success(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(512) @@ -371,7 +371,7 @@ async def test_update_page_if_sequence_number_eq_success(self, resource_group, l @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_update_page_if_sequence_number_eq_failure(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(512) @@ -388,7 +388,7 @@ async def test_update_page_if_sequence_number_eq_failure(self, resource_group, l @AsyncStorageTestCase.await_prepared_test async def test_upload_pages_from_url(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) source_blob_client = await self._create_source_blob(bsc, source_blob_data, 0, SOURCE_BLOB_SIZE) @@ -424,7 +424,7 @@ async def test_upload_pages_from_url(self, resource_group, location, storage_acc @AsyncStorageTestCase.await_prepared_test async def test_upload_pages_from_url_and_validate_content_md5(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) source_blob_client = await self._create_source_blob(bsc, source_blob_data, 0, SOURCE_BLOB_SIZE) @@ -467,7 +467,7 @@ async def test_upload_pages_from_url_and_validate_content_md5(self, resource_gro @AsyncStorageTestCase.await_prepared_test async def test_upload_pages_from_url_with_source_if_modified(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) source_blob_client = await self._create_source_blob(bsc, source_blob_data, 0, SOURCE_BLOB_SIZE) @@ -512,7 +512,7 @@ async def test_upload_pages_from_url_with_source_if_modified(self, resource_grou @AsyncStorageTestCase.await_prepared_test async def test_upload_pages_from_url_with_source_if_unmodified(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) source_blob_client = await self._create_source_blob(bsc, source_blob_data, 0, SOURCE_BLOB_SIZE) @@ -557,7 +557,7 @@ async def test_upload_pages_from_url_with_source_if_unmodified(self, resource_gr @AsyncStorageTestCase.await_prepared_test async def test_upload_pages_from_url_with_source_if_match(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) source_blob_client = await self._create_source_blob(bsc, source_blob_data, 0, SOURCE_BLOB_SIZE) @@ -598,7 +598,7 @@ async def test_upload_pages_from_url_with_source_if_match(self, resource_group, @AsyncStorageTestCase.await_prepared_test async def test_upload_pages_from_url_with_source_if_none_match(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) source_blob_client = await self._create_source_blob(bsc, source_blob_data, 0, SOURCE_BLOB_SIZE) @@ -637,7 +637,7 @@ async def test_upload_pages_from_url_with_source_if_none_match(self, resource_gr @AsyncStorageTestCase.await_prepared_test async def test_upload_pages_from_url_with_if_modified(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) source_blob_client = await self._create_source_blob(bsc, source_blob_data, 0, SOURCE_BLOB_SIZE) @@ -682,7 +682,7 @@ async def test_upload_pages_from_url_with_if_modified(self, resource_group, loca @AsyncStorageTestCase.await_prepared_test async def test_upload_pages_from_url_with_if_unmodified(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) source_blob_client = await self._create_source_blob(bsc, source_blob_data, 0, SOURCE_BLOB_SIZE) @@ -727,7 +727,7 @@ async def test_upload_pages_from_url_with_if_unmodified(self, resource_group, lo @AsyncStorageTestCase.await_prepared_test async def test_upload_pages_from_url_with_if_match(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) source_blob_client = await self._create_source_blob(bsc, source_blob_data, 0, SOURCE_BLOB_SIZE) @@ -768,7 +768,7 @@ async def test_upload_pages_from_url_with_if_match(self, resource_group, locatio @AsyncStorageTestCase.await_prepared_test async def test_upload_pages_from_url_with_if_none_match(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) source_blob_client = await self._create_source_blob(bsc, source_blob_data, 0, SOURCE_BLOB_SIZE) @@ -811,7 +811,7 @@ async def test_upload_pages_from_url_with_if_none_match(self, resource_group, lo @AsyncStorageTestCase.await_prepared_test async def test_upload_pages_from_url_with_sequence_number_lt(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) start_sequence = 10 source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) @@ -853,7 +853,7 @@ async def test_upload_pages_from_url_with_sequence_number_lt(self, resource_grou @AsyncStorageTestCase.await_prepared_test async def test_upload_pages_from_url_with_sequence_number_lte(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) start_sequence = 10 source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) @@ -895,7 +895,7 @@ async def test_upload_pages_from_url_with_sequence_number_lte(self, resource_gro @AsyncStorageTestCase.await_prepared_test async def test_upload_pages_from_url_with_sequence_number_eq(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) start_sequence = 10 source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) @@ -936,7 +936,7 @@ async def test_upload_pages_from_url_with_sequence_number_eq(self, resource_grou @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_update_page_unicode(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -951,7 +951,7 @@ async def test_update_page_unicode(self, resource_group, location, storage_accou @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_page_ranges_no_pages(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -966,7 +966,7 @@ async def test_get_page_ranges_no_pages(self, resource_group, location, storage_ @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_page_ranges_2_pages(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc, 2048) data = self.get_random_bytes(512) @@ -988,7 +988,7 @@ async def test_get_page_ranges_2_pages(self, resource_group, location, storage_a @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_page_ranges_diff(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc, 2048) data = self.get_random_bytes(1536) @@ -1026,7 +1026,7 @@ async def test_get_page_ranges_diff(self, resource_group, location, storage_acco @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_update_page_fail(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc, 2048) data = self.get_random_bytes(512) @@ -1044,7 +1044,7 @@ async def test_update_page_fail(self, resource_group, location, storage_account, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_resize_blob(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc, 1024) @@ -1062,7 +1062,7 @@ async def test_resize_blob(self, resource_group, location, storage_account, stor @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_sequence_number_blob(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -1080,7 +1080,7 @@ async def test_set_sequence_number_blob(self, resource_group, location, storage_ @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_create_page_blob_with_no_overwrite(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = self._get_blob_reference(bsc) data1 = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1113,7 +1113,7 @@ async def test_create_page_blob_with_no_overwrite(self, resource_group, location @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_create_page_blob_with_overwrite(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = self._get_blob_reference(bsc) data1 = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1147,7 +1147,7 @@ async def test_create_page_blob_with_overwrite(self, resource_group, location, s async def test_create_blob_from_bytes(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1167,7 +1167,7 @@ async def test_create_blob_from_bytes(self, resource_group, location, storage_ac async def test_create_blob_from_0_bytes(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(0) @@ -1187,7 +1187,7 @@ async def test_create_blob_from_0_bytes(self, resource_group, location, storage_ async def test_create_blob_from_bytes_with_progress_first(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1216,7 +1216,7 @@ def callback(response): async def test_create_blob_from_bytes_with_index(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1231,7 +1231,7 @@ async def test_create_blob_from_bytes_with_index(self, resource_group, location, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_create_blob_from_bytes_with_index_and_count(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1253,7 +1253,7 @@ async def test_create_blob_from_bytes_with_index_and_count(self, resource_group, async def test_create_blob_from_path(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1278,7 +1278,7 @@ async def test_create_blob_from_path(self, resource_group, location, storage_acc async def test_create_blob_from_path_with_progress(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1308,7 +1308,7 @@ def callback(response): async def test_create_blob_from_stream(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1334,7 +1334,7 @@ async def test_create_blob_from_stream(self, resource_group, location, storage_a async def test_create_blob_from_stream_with_empty_pages(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) # data is almost all empty (0s) except two ranges await self._setup(bsc) blob = self._get_blob_reference(bsc) @@ -1371,7 +1371,7 @@ async def test_create_blob_from_stream_with_empty_pages(self, resource_group, lo async def test_create_blob_from_stream_non_seekable(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1399,7 +1399,7 @@ async def test_create_blob_from_stream_non_seekable(self, resource_group, locati async def test_create_blob_from_stream_with_progress(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1431,7 +1431,7 @@ def callback(response): async def test_create_blob_from_stream_truncated(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1454,7 +1454,7 @@ async def test_create_blob_from_stream_truncated(self, resource_group, location, async def test_create_blob_from_stream_with_progress_truncated(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1483,7 +1483,7 @@ def callback(response): @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_create_blob_with_md5_small(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(512) @@ -1497,10 +1497,10 @@ async def test_create_blob_with_md5_small(self, resource_group, location, storag @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_create_blob_with_md5_large(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1515,7 +1515,7 @@ async def test_create_blob_with_md5_large(self, resource_group, location, storag async def test_incremental_copy_blob(self, resource_group, location, storage_account, storage_account_key): # parallel tests introduce random order of requests, can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) source_blob = await self._create_blob(bsc, 2048) data = self.get_random_bytes(512) @@ -1560,9 +1560,9 @@ async def test_incremental_copy_blob(self, resource_group, location, storage_acc async def test_blob_tier_on_create(self, resource_group, location, storage_account, storage_account_key): # Test can only run live - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) - url = self.account_url(storage_account.name, "blob") + url = self.account_url(storage_account, "blob") credential = storage_account_key pbs = BlobServiceClient(url, credential=credential, transport=AiohttpTestTransport()) @@ -1621,9 +1621,9 @@ async def test_blob_tier_on_create(self, resource_group, location, storage_accou @StorageAccountPreparer(random_name_enabled=True, sku='premium_LRS', name_prefix='pyacrstorage') @AsyncStorageTestCase.await_prepared_test async def test_blob_tier_set_tier_api(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) - url = self.account_url(storage_account.name, "blob") + url = self.account_url(storage_account, "blob") credential = storage_account_key pbs = BlobServiceClient(url, credential=credential, transport=AiohttpTestTransport()) @@ -1680,9 +1680,9 @@ async def test_blob_tier_set_tier_api(self, resource_group, location, storage_ac @StorageAccountPreparer(random_name_enabled=True, sku='premium_LRS', name_prefix='pyacrstorage') @AsyncStorageTestCase.await_prepared_test async def test_blob_tier_copy_blob(self, resource_group, location, storage_account, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) - url = self.account_url(storage_account.name, "blob") + url = self.account_url(storage_account, "blob") credential = storage_account_key pbs = BlobServiceClient(url, credential=credential, transport=AiohttpTestTransport()) @@ -1696,7 +1696,7 @@ async def test_blob_tier_copy_blob(self, resource_group, location, storage_accou except ResourceExistsError: pass - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) source_blob = pbs.get_blob_client( container_name, self.get_resource_name(TEST_BLOB_PREFIX)) @@ -1704,7 +1704,7 @@ async def test_blob_tier_copy_blob(self, resource_group, location, storage_accou # Act source_blob_url = '{0}/{1}/{2}'.format( - self.account_url(storage_account.name, "blob"), container_name, source_blob.blob_name) + self.account_url(storage_account, "blob"), container_name, source_blob.blob_name) copy_blob = pbs.get_blob_client(container_name, 'blob1copy') copy = await copy_blob.start_copy_from_url(source_blob_url, premium_page_blob_tier=PremiumPageBlobTier.P30) @@ -1723,7 +1723,7 @@ async def test_blob_tier_copy_blob(self, resource_group, location, storage_accou await source_blob2.create_page_blob(1024) source_blob2_url = '{0}/{1}/{2}'.format( - self.account_url(storage_account.name, "blob"), source_blob2.container_name, source_blob2.blob_name) + self.account_url(storage_account, "blob"), source_blob2.container_name, source_blob2.blob_name) copy_blob2 = pbs.get_blob_client(container_name, 'blob2copy') copy2 = await copy_blob2.start_copy_from_url(source_blob2_url, premium_page_blob_tier=PremiumPageBlobTier.P60) @@ -1751,7 +1751,7 @@ async def test_blob_tier_copy_blob(self, resource_group, location, storage_accou @AsyncStorageTestCase.await_prepared_test async def _test_download_sparse_page_blob(self, resource_group, location, storage_account, storage_account_key): # Arrange - bsc = BlobServiceClient(self.account_url(storage_account.name, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, transport=AiohttpTestTransport()) await self._setup(bsc) self.config.max_single_get_size = 4*1024 self.config.max_chunk_get_size = 1024 diff --git a/sdk/storage/azure-storage-blob/tests/test_retry.py b/sdk/storage/azure-storage-blob/tests/test_retry.py index 2fa2a06d880e..6fe9906cb403 100644 --- a/sdk/storage/azure-storage-blob/tests/test_retry.py +++ b/sdk/storage/azure-storage-blob/tests/test_retry.py @@ -50,7 +50,7 @@ def _create_storage_service(self, service_class, account, key, connection_string if connection_string: service = service_class.from_connection_string(connection_string, **kwargs) else: - service = service_class(self.account_url(account.name, "blob"), credential=key, **kwargs) + service = service_class(self.account_url(account, "blob"), credential=key, **kwargs) return service # --Test Cases -------------------------------------------- diff --git a/sdk/storage/azure-storage-blob/tests/test_retry_async.py b/sdk/storage/azure-storage-blob/tests/test_retry_async.py index 8458fb4e138e..e01965123db2 100644 --- a/sdk/storage/azure-storage-blob/tests/test_retry_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_retry_async.py @@ -67,7 +67,7 @@ def _create_storage_service(self, service_class, account, key, connection_string if connection_string: service = service_class.from_connection_string(connection_string, **kwargs) else: - service = service_class(self.account_url(account.name, "blob"), credential=key, **kwargs) + service = service_class(self.account_url(account, "blob"), credential=key, **kwargs) return service # --Test Cases -------------------------------------------- diff --git a/sdk/storage/azure-storage-file-share/tests/_shared/asynctestcase.py b/sdk/storage/azure-storage-file-share/tests/_shared/asynctestcase.py index 8ce71c036acb..03166f083a8a 100644 --- a/sdk/storage/azure-storage-file-share/tests/_shared/asynctestcase.py +++ b/sdk/storage/azure-storage-file-share/tests/_shared/asynctestcase.py @@ -8,6 +8,8 @@ import asyncio import functools +from azure_devtools.scenario_tests.utilities import trim_kwargs_from_test_function + from azure.core.credentials import AccessToken from .filetestcase import FileTestCase @@ -34,6 +36,7 @@ def await_prepared_test(test_fn): @functools.wraps(test_fn) def run(test_class_instance, *args, **kwargs): + trim_kwargs_from_test_function(test_fn, kwargs) loop = asyncio.get_event_loop() return loop.run_until_complete(test_fn(test_class_instance, **kwargs)) diff --git a/sdk/storage/azure-storage-queue/tests/_shared/asynctestcase.py b/sdk/storage/azure-storage-queue/tests/_shared/asynctestcase.py index a0b74f7c28fa..b00ffa6f3207 100644 --- a/sdk/storage/azure-storage-queue/tests/_shared/asynctestcase.py +++ b/sdk/storage/azure-storage-queue/tests/_shared/asynctestcase.py @@ -8,6 +8,8 @@ import asyncio import functools +from azure_devtools.scenario_tests.utilities import trim_kwargs_from_test_function + from azure.core.credentials import AccessToken from .testcase import StorageTestCase @@ -34,6 +36,7 @@ def await_prepared_test(test_fn): @functools.wraps(test_fn) def run(test_class_instance, *args, **kwargs): + trim_kwargs_from_test_function(test_fn, kwargs) loop = asyncio.get_event_loop() return loop.run_until_complete(test_fn(test_class_instance, **kwargs)) diff --git a/sdk/storage/azure-storage-queue/tests/_shared/testcase.py b/sdk/storage/azure-storage-queue/tests/_shared/testcase.py index afd47225c850..d1d386a3e14f 100644 --- a/sdk/storage/azure-storage-queue/tests/_shared/testcase.py +++ b/sdk/storage/azure-storage-queue/tests/_shared/testcase.py @@ -25,7 +25,13 @@ import random import re import logging -from devtools_testutils import AzureMgmtTestCase, AzureMgmtPreparer, ResourceGroupPreparer, StorageAccountPreparer, FakeResource +from devtools_testutils import ( + AzureMgmtTestCase, + AzureMgmtPreparer, + ResourceGroupPreparer, + StorageAccountPreparer, + FakeResource, +) from azure_devtools.scenario_tests import RecordingProcessor, AzureTestError, create_random_name try: from cStringIO import StringIO # Python 2 @@ -34,6 +40,7 @@ from azure.core.credentials import AccessToken from azure.storage.queue import generate_account_sas, AccountSasPermissions, ResourceTypes +from azure.mgmt.storage.models import StorageAccount, Endpoints try: from devtools_testutils import mgmt_settings_real as settings @@ -87,16 +94,19 @@ def create_resource(self, name, **kwargs): "storagename" ) else: - storage_account = FakeResource( - id=storage_account.id, - name="storagename" - ) + name = "storagename" + storage_account.name = name + storage_account.primary_endpoints.blob = 'https://{}.{}.core.windows.net'.format(name, 'blob') + storage_account.primary_endpoints.queue = 'https://{}.{}.core.windows.net'.format(name, 'queue') + storage_account.primary_endpoints.table = 'https://{}.{}.core.windows.net'.format(name, 'table') + storage_account.primary_endpoints.file = 'https://{}.{}.core.windows.net'.format(name, 'file') return { 'location': 'westus', 'resource_group': StorageTestCase._RESOURCE_GROUP, 'storage_account': storage_account, 'storage_account_key': StorageTestCase._STORAGE_KEY, + 'storage_account_cs': StorageTestCase._STORAGE_CONNECTION_STRING, } class GlobalResourceGroupPreparer(AzureMgmtPreparer): @@ -134,13 +144,23 @@ def __init__(self, *args, **kwargs): def connection_string(self, account, key): return "DefaultEndpointsProtocol=https;AccountName=" + account.name + ";AccountKey=" + str(key) + ";EndpointSuffix=core.windows.net" - def account_url(self, name, storage_type): + def account_url(self, storage_account, storage_type): """Return an url of storage account. - :param str name: Storage account name + :param str storage_account: Storage account name :param str storage_type: The Storage type part of the URL. Should be "blob", or "queue", etc. """ - return 'https://{}.{}.core.windows.net'.format(name, storage_type) + try: + if storage_type == "blob": + return storage_account.primary_endpoints.blob.rstrip("/") + if storage_type == "queue": + return storage_account.primary_endpoints.queue.rstrip("/") + if storage_type == "file": + return storage_account.primary_endpoints.file.rstrip("/") + else: + raise ValueError("Unknown storage type {}".format(storage_type)) + except AttributeError: # Didn't find "primary_endpoints" + return 'https://{}.{}.core.windows.net'.format(storage_account, storage_type) def configure_logging(self): try: @@ -348,22 +368,109 @@ def storage_account(): storage_preparer = StorageAccountPreparer(random_name_enabled=True, name_prefix='pyacrstorage') # Create + subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", None) + location = os.environ.get("AZURE_LOCATION", "westus") + + existing_rg_name = os.environ.get("AZURE_RESOURCEGROUP_NAME") + existing_storage_name = os.environ.get("AZURE_STORAGE_ACCOUNT_NAME") + existing_storage_key = os.environ.get("AZURE_STORAGE_ACCOUNT_KEY") + storage_connection_string = os.environ.get("AZURE_STORAGE_CONNECTION_STRING") + + i_need_to_create_rg = not (existing_rg_name or existing_storage_name or storage_connection_string) + got_storage_info_from_env = existing_storage_name or storage_connection_string + try: - rg_name, rg_kwargs = rg_preparer._prepare_create_resource(test_case) - StorageTestCase._RESOURCE_GROUP = rg_kwargs['resource_group'] + if i_need_to_create_rg: + rg_name, rg_kwargs = rg_preparer._prepare_create_resource(test_case) + rg = rg_kwargs['resource_group'] + else: + rg_name = existing_rg_name or "no_rg_needed" + rg = FakeResource( + name=rg_name, + id="/subscriptions/{}/resourceGroups/{}".format(subscription_id, rg_name) + ) + StorageTestCase._RESOURCE_GROUP = rg + try: - storage_name, storage_kwargs = storage_preparer._prepare_create_resource(test_case, **rg_kwargs) - # Now the magic begins - StorageTestCase._STORAGE_ACCOUNT = storage_kwargs['storage_account'] - StorageTestCase._STORAGE_KEY = storage_kwargs['storage_account_key'] + if got_storage_info_from_env: + + if storage_connection_string: + storage_connection_string_parts = dict([ + part.split('=', 1) + for part in storage_connection_string.split(";") + ]) + + storage_account = None + if existing_storage_name: + storage_name = existing_storage_name + storage_account = StorageAccount( + location=location, + ) + storage_account.name = storage_name + storage_account.id = storage_name + storage_account.primary_endpoints=Endpoints() + storage_account.primary_endpoints.blob = 'https://{}.{}.core.windows.net'.format(storage_name, 'blob') + storage_account.primary_endpoints.queue = 'https://{}.{}.core.windows.net'.format(storage_name, 'queue') + storage_account.primary_endpoints.table = 'https://{}.{}.core.windows.net'.format(storage_name, 'table') + storage_account.primary_endpoints.file = 'https://{}.{}.core.windows.net'.format(storage_name, 'file') + storage_key = existing_storage_key + + if not storage_connection_string: + # It means I have received a storage name from env + storage_connection_string=";".join([ + "DefaultEndpointsProtocol=https", + "AccountName={}".format(storage_name), + "AccountKey={}".format(storage_key), + "BlobEndpoint={}".format(storage_account.primary_endpoints.blob), + "TableEndpoint={}".format(storage_account.primary_endpoints.table), + "QueueEndpoint={}".format(storage_account.primary_endpoints.queue), + "FileEndpoint={}".format(storage_account.primary_endpoints.file), + ]) + + if not storage_account: + # It means I have received a connection string + storage_name = storage_connection_string_parts["AccountName"] + storage_account = StorageAccount( + location=location, + ) + + def build_service_endpoint(service): + return "{}://{}.{}.{}".format( + storage_connection_string_parts.get("DefaultEndpointsProtocol", "https"), + storage_connection_string_parts["AccountName"], + service, + storage_connection_string_parts["EndpointSuffix"], # Let it fail if we don't even have that + ) + + storage_account.name = storage_name + storage_account.id = storage_name + storage_account.primary_endpoints=Endpoints() + storage_account.primary_endpoints.blob = storage_connection_string_parts.get("BlobEndpoint", build_service_endpoint("blob")) + storage_account.primary_endpoints.queue = storage_connection_string_parts.get("QueueEndpoint", build_service_endpoint("queue")) + storage_account.primary_endpoints.file = storage_connection_string_parts.get("FileEndpoint", build_service_endpoint("file")) + storage_account.secondary_endpoints=Endpoints() + storage_account.secondary_endpoints.blob = storage_connection_string_parts.get("BlobSecondaryEndpoint", build_service_endpoint("blob")) + storage_account.secondary_endpoints.queue = storage_connection_string_parts.get("QueueSecondaryEndpoint", build_service_endpoint("queue")) + storage_account.secondary_endpoints.file = storage_connection_string_parts.get("FileSecondaryEndpoint", build_service_endpoint("file")) + storage_key = storage_connection_string_parts["AccountKey"] + + else: + storage_name, storage_kwargs = storage_preparer._prepare_create_resource(test_case, **rg_kwargs) + storage_account = storage_kwargs['storage_account'] + storage_key = storage_kwargs['storage_account_key'] + storage_connection_string = storage_kwargs['storage_account_cs'] + + StorageTestCase._STORAGE_ACCOUNT = storage_account + StorageTestCase._STORAGE_KEY = storage_key + StorageTestCase._STORAGE_CONNECTION_STRING = storage_connection_string yield finally: - storage_preparer.remove_resource( - storage_name, - resource_group=rg_kwargs['resource_group'] - ) - StorageTestCase._STORAGE_ACCOUNT = None - StorageTestCase._STORAGE_KEY = None + if not got_storage_info_from_env: + storage_preparer.remove_resource( + storage_name, + resource_group=rg + ) finally: - rg_preparer.remove_resource(rg_name) + if i_need_to_create_rg: + rg_preparer.remove_resource(rg_name) StorageTestCase._RESOURCE_GROUP = None diff --git a/sdk/storage/azure-storage-queue/tests/test_queue.py b/sdk/storage/azure-storage-queue/tests/test_queue.py index 1a66ab17ef82..636fde48d224 100644 --- a/sdk/storage/azure-storage-queue/tests/test_queue.py +++ b/sdk/storage/azure-storage-queue/tests/test_queue.py @@ -61,7 +61,7 @@ def _create_queue(self, qsc, prefix=TEST_QUEUE_PREFIX, queue_list = None): @GlobalStorageAccountPreparer() def test_create_queue(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) created = queue_client.create_queue() @@ -71,7 +71,7 @@ def test_create_queue(self, resource_group, location, storage_account, storage_a @GlobalStorageAccountPreparer() def test_create_queue_fail_on_exist(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) created = queue_client.create_queue() with self.assertRaises(ResourceExistsError): @@ -83,7 +83,7 @@ def test_create_queue_fail_on_exist(self, resource_group, location, storage_acco @GlobalStorageAccountPreparer() def test_create_queue_fail_on_exist_different_metadata(self, resource_group, location, storage_account, storage_account_key): # Action - url = self.account_url(storage_account.name, "queue") + url = self.account_url(storage_account, "queue") qsc = QueueServiceClient(url, storage_account_key) queue_client = self._get_queue_reference(qsc) created = queue_client.create_queue() @@ -96,7 +96,7 @@ def test_create_queue_fail_on_exist_different_metadata(self, resource_group, loc @GlobalStorageAccountPreparer() def test_create_queue_with_options(self, resource_group, location, storage_account, storage_account_key): # Action - url = self.account_url(storage_account.name, "queue") + url = self.account_url(storage_account, "queue") qsc = QueueServiceClient(url, storage_account_key) queue_client = self._get_queue_reference(qsc) queue_client.create_queue( @@ -112,7 +112,7 @@ def test_create_queue_with_options(self, resource_group, location, storage_accou @GlobalStorageAccountPreparer() def test_delete_non_existing_queue(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) # Asserts @@ -122,7 +122,7 @@ def test_delete_non_existing_queue(self, resource_group, location, storage_accou @GlobalStorageAccountPreparer() def test_delete_existing_queue_fail_not_exist(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) created = queue_client.create_queue() @@ -134,7 +134,7 @@ def test_delete_existing_queue_fail_not_exist(self, resource_group, location, st @GlobalStorageAccountPreparer() def test_list_queues(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queues = list(qsc.list_queues()) @@ -147,7 +147,7 @@ def test_list_queues(self, resource_group, location, storage_account, storage_ac def test_list_queues_with_options(self, resource_group, location, storage_account, storage_account_key): # Arrange prefix = 'listqueue' - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_list = [] for i in range(0, 4): self._create_queue(qsc, prefix + str(i), queue_list) @@ -179,7 +179,7 @@ def test_list_queues_with_options(self, resource_group, location, storage_accoun @GlobalStorageAccountPreparer() def test_list_queues_with_metadata(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue = self._get_queue_reference(qsc) queue.create_queue() queue.set_queue_metadata(metadata={'val1': 'test', 'val2': 'blah'}) @@ -199,7 +199,7 @@ def test_list_queues_with_metadata(self, resource_group, location, storage_accou @GlobalStorageAccountPreparer() def test_set_queue_metadata(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue = self._get_queue_reference(qsc) metadata = {'hello': 'world', 'number': '43'} queue.create_queue() @@ -213,7 +213,7 @@ def test_set_queue_metadata(self, resource_group, location, storage_account, sto @GlobalStorageAccountPreparer() def test_get_queue_metadata_message_count(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message(u'message1') @@ -226,7 +226,7 @@ def test_get_queue_metadata_message_count(self, resource_group, location, storag @GlobalStorageAccountPreparer() def test_queue_exists(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue = self._get_queue_reference(qsc) queue.create_queue() @@ -239,7 +239,7 @@ def test_queue_exists(self, resource_group, location, storage_account, storage_a @GlobalStorageAccountPreparer() def test_queue_not_exists(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue = qsc.get_queue_client(self.get_resource_name('missing')) # Act with self.assertRaises(ResourceNotFoundError): @@ -250,7 +250,7 @@ def test_queue_not_exists(self, resource_group, location, storage_account, stora @GlobalStorageAccountPreparer() def test_put_message(self, resource_group, location, storage_account, storage_account_key): # Action. No exception means pass. No asserts needed. - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message(u'message1') @@ -269,7 +269,7 @@ def test_put_message(self, resource_group, location, storage_account, storage_ac @GlobalStorageAccountPreparer() def test_put_message_large_time_to_live(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() # There should be no upper bound on a queue message's time to live @@ -286,7 +286,7 @@ def test_put_message_large_time_to_live(self, resource_group, location, storage_ @GlobalStorageAccountPreparer() def test_put_message_infinite_time_to_live(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message(u'message1', time_to_live=-1) @@ -300,7 +300,7 @@ def test_put_message_infinite_time_to_live(self, resource_group, location, stora @GlobalStorageAccountPreparer() def test_get_messages(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message(u'message1') @@ -324,7 +324,7 @@ def test_get_messages(self, resource_group, location, storage_account, storage_a @GlobalStorageAccountPreparer() def test_get_messages_with_options(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message(u'message1') @@ -351,7 +351,7 @@ def test_get_messages_with_options(self, resource_group, location, storage_accou @GlobalStorageAccountPreparer() def test_peek_messages(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message(u'message1') @@ -376,7 +376,7 @@ def test_peek_messages(self, resource_group, location, storage_account, storage_ @GlobalStorageAccountPreparer() def test_peek_messages_with_options(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message(u'message1') @@ -401,7 +401,7 @@ def test_peek_messages_with_options(self, resource_group, location, storage_acco @GlobalStorageAccountPreparer() def test_clear_messages(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message(u'message1') @@ -418,7 +418,7 @@ def test_clear_messages(self, resource_group, location, storage_account, storage @GlobalStorageAccountPreparer() def test_delete_message(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message(u'message1') @@ -438,7 +438,7 @@ def test_delete_message(self, resource_group, location, storage_account, storage @GlobalStorageAccountPreparer() def test_update_message(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message(u'message1') @@ -472,7 +472,7 @@ def test_update_message(self, resource_group, location, storage_account, storage @GlobalStorageAccountPreparer() def test_update_message_content(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message(u'message1') @@ -511,7 +511,7 @@ def test_account_sas(self, resource_group, location, storage_account, storage_ac # SAS URL is calculated from storage key, so this test runs live only # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message(u'message1') @@ -546,18 +546,18 @@ def test_token_credential(self, resource_group, location, storage_account, stora token_credential = self.generate_oauth_token() # Action 1: make sure token works - service = QueueServiceClient(self.account_url(storage_account.name, "queue"), credential=token_credential) + service = QueueServiceClient(self.account_url(storage_account, "queue"), credential=token_credential) queues = service.get_service_properties() self.assertIsNotNone(queues) # Action 2: change token value to make request fail fake_credential = self.generate_fake_token() - service = QueueServiceClient(self.account_url(storage_account.name, "queue"), credential=fake_credential) + service = QueueServiceClient(self.account_url(storage_account, "queue"), credential=fake_credential) with self.assertRaises(ClientAuthenticationError): list(service.list_queues()) # Action 3: update token to make it working again - service = QueueServiceClient(self.account_url(storage_account.name, "queue"), credential=token_credential) + service = QueueServiceClient(self.account_url(storage_account, "queue"), credential=token_credential) queues = list(service.list_queues()) self.assertIsNotNone(queues) @@ -567,7 +567,7 @@ def test_sas_read(self, resource_group, location, storage_account, storage_accou # SAS URL is calculated from storage key, so this test runs live only # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message(u'message1') @@ -601,7 +601,7 @@ def test_sas_add(self, resource_group, location, storage_account, storage_accoun # SAS URL is calculated from storage key, so this test runs live only # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() token = generate_queue_sas( @@ -629,7 +629,7 @@ def test_sas_update(self, resource_group, location, storage_account, storage_acc # SAS URL is calculated from storage key, so this test runs live only # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message(u'message1') @@ -665,7 +665,7 @@ def test_sas_process(self, resource_group, location, storage_account, storage_ac # SAS URL is calculated from storage key, so this test runs live only # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message(u'message1') @@ -702,7 +702,7 @@ def test_sas_signed_identifier(self, resource_group, location, storage_account, identifiers = {'testid': access_policy} - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() resp = queue_client.set_queue_access_policy(identifiers) @@ -734,7 +734,7 @@ def test_sas_signed_identifier(self, resource_group, location, storage_account, @GlobalStorageAccountPreparer() def test_get_queue_acl(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() @@ -748,7 +748,7 @@ def test_get_queue_acl(self, resource_group, location, storage_account, storage_ @GlobalStorageAccountPreparer() def test_get_queue_acl_iter(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() @@ -764,7 +764,7 @@ def test_get_queue_acl_iter(self, resource_group, location, storage_account, sto @GlobalStorageAccountPreparer() def test_get_queue_acl_with_non_existing_queue(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) # Act @@ -776,7 +776,7 @@ def test_get_queue_acl_with_non_existing_queue(self, resource_group, location, s @GlobalStorageAccountPreparer() def test_set_queue_acl(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() @@ -791,7 +791,7 @@ def test_set_queue_acl(self, resource_group, location, storage_account, storage_ @GlobalStorageAccountPreparer() def test_set_queue_acl_with_empty_signed_identifiers(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() @@ -806,7 +806,7 @@ def test_set_queue_acl_with_empty_signed_identifiers(self, resource_group, locat @GlobalStorageAccountPreparer() def test_set_queue_acl_with_empty_signed_identifier(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() @@ -825,7 +825,7 @@ def test_set_queue_acl_with_empty_signed_identifier(self, resource_group, locati @GlobalStorageAccountPreparer() def test_set_queue_acl_with_signed_identifiers(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() @@ -847,7 +847,7 @@ def test_set_queue_acl_with_signed_identifiers(self, resource_group, location, s @GlobalStorageAccountPreparer() def test_set_queue_acl_too_many_ids(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() @@ -863,7 +863,7 @@ def test_set_queue_acl_too_many_ids(self, resource_group, location, storage_acco @GlobalStorageAccountPreparer() def test_set_queue_acl_with_non_existing_queue(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) # Act @@ -875,7 +875,7 @@ def test_set_queue_acl_with_non_existing_queue(self, resource_group, location, s @GlobalStorageAccountPreparer() def test_unicode_create_queue_unicode_name(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_name = u'啊齄丂狛狜' with self.assertRaises(HttpResponseError): @@ -889,7 +889,7 @@ def test_unicode_create_queue_unicode_name(self, resource_group, location, stora def test_unicode_get_messages_unicode_data(self, resource_group, location, storage_account, storage_account_key): # Action pytest.skip("Uncomment after msrest fix") - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message(u'message1㚈') @@ -909,7 +909,7 @@ def test_unicode_get_messages_unicode_data(self, resource_group, location, stora def test_unicode_update_message_unicode_data(self, resource_group, location, storage_account, storage_account_key): # Action pytest.skip("Uncomment after msrest fix") - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message(u'message1') @@ -936,7 +936,7 @@ def test_transport_closed_only_once(self, resource_group, location, storage_acco transport = RequestsTransport() prefix = TEST_QUEUE_PREFIX queue_name = self.get_resource_name(prefix) - with QueueServiceClient(self.account_url(storage_account.name, "queue"), credential=storage_account_key, transport=transport) as qsc: + with QueueServiceClient(self.account_url(storage_account, "queue"), credential=storage_account_key, transport=transport) as qsc: qsc.get_service_properties() assert transport.session is not None with qsc.get_queue_client(queue_name) as qc: diff --git a/sdk/storage/azure-storage-queue/tests/test_queue_async.py b/sdk/storage/azure-storage-queue/tests/test_queue_async.py index 62604f56a54a..26202ca33c5e 100644 --- a/sdk/storage/azure-storage-queue/tests/test_queue_async.py +++ b/sdk/storage/azure-storage-queue/tests/test_queue_async.py @@ -74,7 +74,7 @@ async def _create_queue(self, qsc, prefix=TEST_QUEUE_PREFIX, queue_list = None): @AsyncStorageTestCase.await_prepared_test async def test_create_queue(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue_client = self._get_queue_reference(qsc) created = await queue_client.create_queue() @@ -85,7 +85,7 @@ async def test_create_queue(self, resource_group, location, storage_account, sto @AsyncStorageTestCase.await_prepared_test async def test_create_queue_fail_on_exist(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue_client = self._get_queue_reference(qsc) created = await queue_client.create_queue() with self.assertRaises(ResourceExistsError): @@ -98,7 +98,7 @@ async def test_create_queue_fail_on_exist(self, resource_group, location, storag @AsyncStorageTestCase.await_prepared_test async def test_create_queue_fail_on_exist_different_metadata(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue_client = self._get_queue_reference(qsc) created = await queue_client.create_queue() with self.assertRaises(ResourceExistsError): @@ -111,7 +111,7 @@ async def test_create_queue_fail_on_exist_different_metadata(self, resource_grou @AsyncStorageTestCase.await_prepared_test async def test_create_queue_with_options(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue_client = self._get_queue_reference(qsc) await queue_client.create_queue( metadata={'val1': 'test', 'val2': 'blah'}) @@ -127,7 +127,7 @@ async def test_create_queue_with_options(self, resource_group, location, storage @AsyncStorageTestCase.await_prepared_test async def test_delete_non_existing_queue(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue_client = self._get_queue_reference(qsc) # Asserts @@ -138,7 +138,7 @@ async def test_delete_non_existing_queue(self, resource_group, location, storage @AsyncStorageTestCase.await_prepared_test async def test_delete_existing_queue_fail_not_exist(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue_client = self._get_queue_reference(qsc) created = await queue_client.create_queue() @@ -151,7 +151,7 @@ async def test_delete_existing_queue_fail_not_exist(self, resource_group, locati @AsyncStorageTestCase.await_prepared_test async def test_list_queues(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue_client = self._get_queue_reference(qsc) await queue_client.create_queue() queues = [] @@ -166,7 +166,7 @@ async def test_list_queues(self, resource_group, location, storage_account, stor @AsyncStorageTestCase.await_prepared_test async def test_list_queues_with_options(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue_list = [] prefix = 'listqueue' for i in range(0, 4): @@ -203,7 +203,7 @@ async def test_list_queues_with_options(self, resource_group, location, storage_ @AsyncStorageTestCase.await_prepared_test async def test_list_queues_with_metadata(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue = await self._create_queue(qsc) await queue.set_queue_metadata(metadata={'val1': 'test', 'val2': 'blah'}) @@ -226,7 +226,7 @@ async def test_list_queues_with_metadata(self, resource_group, location, storage @AsyncStorageTestCase.await_prepared_test async def test_set_queue_metadata(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) metadata = {'hello': 'world', 'number': '43'} queue = await self._create_queue(qsc) @@ -241,7 +241,7 @@ async def test_set_queue_metadata(self, resource_group, location, storage_accoun @AsyncStorageTestCase.await_prepared_test async def test_get_queue_metadata_message_count(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue_client = await self._create_queue(qsc) await queue_client.send_message(u'message1') props = await queue_client.get_queue_properties() @@ -254,7 +254,7 @@ async def test_get_queue_metadata_message_count(self, resource_group, location, @AsyncStorageTestCase.await_prepared_test async def test_queue_exists(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue = await self._create_queue(qsc) # Act @@ -267,7 +267,7 @@ async def test_queue_exists(self, resource_group, location, storage_account, sto @AsyncStorageTestCase.await_prepared_test async def test_queue_not_exists(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue = qsc.get_queue_client(self.get_resource_name('missing')) # Act with self.assertRaises(ResourceNotFoundError): @@ -279,7 +279,7 @@ async def test_queue_not_exists(self, resource_group, location, storage_account, @AsyncStorageTestCase.await_prepared_test async def test_put_message(self, resource_group, location, storage_account, storage_account_key): # Action. No exception means pass. No asserts needed. - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue_client = await self._create_queue(qsc) await queue_client.send_message(u'message1') await queue_client.send_message(u'message2') @@ -298,7 +298,7 @@ async def test_put_message(self, resource_group, location, storage_account, stor @AsyncStorageTestCase.await_prepared_test async def test_put_message_large_time_to_live(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue_client = await self._create_queue(qsc) # There should be no upper bound on a queue message's time to live await queue_client.send_message(u'message1', time_to_live=1024*1024*1024) @@ -315,7 +315,7 @@ async def test_put_message_large_time_to_live(self, resource_group, location, st @AsyncStorageTestCase.await_prepared_test async def test_put_message_infinite_time_to_live(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue_client = await self._create_queue(qsc) await queue_client.send_message(u'message1', time_to_live=-1) @@ -329,7 +329,7 @@ async def test_put_message_infinite_time_to_live(self, resource_group, location, @AsyncStorageTestCase.await_prepared_test async def test_get_messages(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue_client = await self._create_queue(qsc) await queue_client.send_message(u'message1') await queue_client.send_message(u'message2') @@ -357,7 +357,7 @@ async def test_get_messages(self, resource_group, location, storage_account, sto @AsyncStorageTestCase.await_prepared_test async def test_get_messages_with_options(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue_client = await self._create_queue(qsc) await queue_client.send_message(u'message1') await queue_client.send_message(u'message2') @@ -386,7 +386,7 @@ async def test_get_messages_with_options(self, resource_group, location, storage @AsyncStorageTestCase.await_prepared_test async def test_peek_messages(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue_client = await self._create_queue(qsc) await queue_client.send_message(u'message1') await queue_client.send_message(u'message2') @@ -411,7 +411,7 @@ async def test_peek_messages(self, resource_group, location, storage_account, st @AsyncStorageTestCase.await_prepared_test async def test_peek_messages_with_options(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue_client = await self._create_queue(qsc) await queue_client.send_message(u'message1') await queue_client.send_message(u'message2') @@ -436,7 +436,7 @@ async def test_peek_messages_with_options(self, resource_group, location, storag @AsyncStorageTestCase.await_prepared_test async def test_clear_messages(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue_client = await self._create_queue(qsc) await queue_client.send_message(u'message1') await queue_client.send_message(u'message2') @@ -453,7 +453,7 @@ async def test_clear_messages(self, resource_group, location, storage_account, s @AsyncStorageTestCase.await_prepared_test async def test_delete_message(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue_client = await self._create_queue(qsc) await queue_client.send_message(u'message1') await queue_client.send_message(u'message2') @@ -473,7 +473,7 @@ async def test_delete_message(self, resource_group, location, storage_account, s @AsyncStorageTestCase.await_prepared_test async def test_update_message(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue_client = await self._create_queue(qsc) await queue_client.send_message(u'message1') messages = [] @@ -512,7 +512,7 @@ async def test_update_message(self, resource_group, location, storage_account, s @AsyncStorageTestCase.await_prepared_test async def test_update_message_content(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue_client = await self._create_queue(qsc) await queue_client.send_message(u'message1') @@ -554,7 +554,7 @@ async def test_update_message_content(self, resource_group, location, storage_ac @AsyncStorageTestCase.await_prepared_test async def test_account_sas(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) # Arrange queue_client = await self._create_queue(qsc) @@ -588,22 +588,22 @@ async def test_account_sas(self, resource_group, location, storage_account, stor @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_token_credential(self, resource_group, location, storage_account, storage_account_key): - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) token_credential = self.generate_oauth_token() # Action 1: make sure token works - service = QueueServiceClient(self.account_url(storage_account.name, "queue"), credential=token_credential) + service = QueueServiceClient(self.account_url(storage_account, "queue"), credential=token_credential) queues = await service.get_service_properties() self.assertIsNotNone(queues) # Action 2: change token value to make request fail fake_credential = self.generate_fake_token() - service = QueueServiceClient(self.account_url(storage_account.name, "queue"), credential=fake_credential) + service = QueueServiceClient(self.account_url(storage_account, "queue"), credential=fake_credential) with self.assertRaises(ClientAuthenticationError): await service.get_service_properties() # Action 3: update token to make it working again - service = QueueServiceClient(self.account_url(storage_account.name, "queue"), credential=token_credential) + service = QueueServiceClient(self.account_url(storage_account, "queue"), credential=token_credential) queues = await service.get_service_properties() # Not raise means success self.assertIsNotNone(queues) @@ -611,7 +611,7 @@ async def test_token_credential(self, resource_group, location, storage_account, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_sas_read(self, resource_group, location, storage_account, storage_account_key): - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) # SAS URL is calculated from storage key, so this test runs live only # Arrange @@ -645,7 +645,7 @@ async def test_sas_read(self, resource_group, location, storage_account, storage @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_sas_add(self, resource_group, location, storage_account, storage_account_key): - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) # SAS URL is calculated from storage key, so this test runs live only # Arrange @@ -676,7 +676,7 @@ async def test_sas_add(self, resource_group, location, storage_account, storage_ @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_sas_update(self, resource_group, location, storage_account, storage_account_key): - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) # SAS URL is calculated from storage key, so this test runs live only # Arrange @@ -717,7 +717,7 @@ async def test_sas_update(self, resource_group, location, storage_account, stora @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_sas_process(self, resource_group, location, storage_account, storage_account_key): - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) # SAS URL is calculated from storage key, so this test runs live only # Arrange @@ -750,7 +750,7 @@ async def test_sas_process(self, resource_group, location, storage_account, stor @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_sas_signed_identifier(self, resource_group, location, storage_account, storage_account_key): - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) # SAS URL is calculated from storage key, so this test runs live only # Arrange @@ -791,7 +791,7 @@ async def test_sas_signed_identifier(self, resource_group, location, storage_acc @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_queue_acl(self, resource_group, location, storage_account, storage_account_key): - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) # Arrange queue_client = await self._create_queue(qsc) @@ -805,7 +805,7 @@ async def test_get_queue_acl(self, resource_group, location, storage_account, st @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_queue_acl_iter(self, resource_group, location, storage_account, storage_account_key): - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) # Arrange queue_client = await self._create_queue(qsc) @@ -821,7 +821,7 @@ async def test_get_queue_acl_iter(self, resource_group, location, storage_accoun @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_queue_acl_with_non_existing_queue(self, resource_group, location, storage_account, storage_account_key): - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) # Arrange queue_client = self._get_queue_reference(qsc) @@ -834,7 +834,7 @@ async def test_get_queue_acl_with_non_existing_queue(self, resource_group, locat @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_queue_acl(self, resource_group, location, storage_account, storage_account_key): - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) # Arrange queue_client = await self._create_queue(qsc) @@ -849,7 +849,7 @@ async def test_set_queue_acl(self, resource_group, location, storage_account, st @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_queue_acl_with_empty_signed_identifiers(self, resource_group, location, storage_account, storage_account_key): - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) # Arrange queue_client = await self._create_queue(qsc) @@ -864,7 +864,7 @@ async def test_set_queue_acl_with_empty_signed_identifiers(self, resource_group, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_set_queue_acl_with_empty_signed_identifier(self, resource_group, location, storage_account, storage_account_key): - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) # Arrange queue_client = await self._create_queue(qsc) @@ -884,7 +884,7 @@ async def test_set_queue_acl_with_empty_signed_identifier(self, resource_group, @AsyncStorageTestCase.await_prepared_test async def test_set_queue_acl_with_signed_identifiers(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue_client = await self._create_queue(qsc) # Act @@ -906,7 +906,7 @@ async def test_set_queue_acl_with_signed_identifiers(self, resource_group, locat @AsyncStorageTestCase.await_prepared_test async def test_set_queue_acl_too_many_ids(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue_client = await self._create_queue(qsc) # Act @@ -922,7 +922,7 @@ async def test_set_queue_acl_too_many_ids(self, resource_group, location, storag @AsyncStorageTestCase.await_prepared_test async def test_set_queue_acl_with_non_existing_queue(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue_client = self._get_queue_reference(qsc) # Act @@ -933,7 +933,7 @@ async def test_set_queue_acl_with_non_existing_queue(self, resource_group, locat @AsyncStorageTestCase.await_prepared_test async def test_unicode_create_queue_unicode_name(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue_name = u'啊齄丂狛狜' with self.assertRaises(HttpResponseError): @@ -947,7 +947,7 @@ async def test_unicode_create_queue_unicode_name(self, resource_group, location, @AsyncStorageTestCase.await_prepared_test async def test_unicode_get_messages_unicode_data(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue_client = await self._create_queue(qsc) await queue_client.send_message(u'message1㚈') message = None @@ -967,7 +967,7 @@ async def test_unicode_get_messages_unicode_data(self, resource_group, location, @AsyncStorageTestCase.await_prepared_test async def test_unicode_update_message_unicode_data(self, resource_group, location, storage_account, storage_account_key): # Action - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue_client = await self._create_queue(qsc) await queue_client.send_message(u'message1') messages = [] @@ -998,7 +998,7 @@ async def test_transport_closed_only_once_async(self, resource_group, location, transport = AioHttpTransport() prefix = TEST_QUEUE_PREFIX queue_name = self.get_resource_name(prefix) - async with QueueServiceClient(self.account_url(storage_account.name, "queue"), credential=storage_account_key, transport=transport) as qsc: + async with QueueServiceClient(self.account_url(storage_account, "queue"), credential=storage_account_key, transport=transport) as qsc: await qsc.get_service_properties() assert transport.session is not None async with qsc.get_queue_client(queue_name) as qc: diff --git a/sdk/storage/azure-storage-queue/tests/test_queue_client.py b/sdk/storage/azure-storage-queue/tests/test_queue_client.py index 99ecca8a2867..b91818dd1c7f 100644 --- a/sdk/storage/azure-storage-queue/tests/test_queue_client.py +++ b/sdk/storage/azure-storage-queue/tests/test_queue_client.py @@ -47,7 +47,7 @@ def test_create_service_with_key(self, resource_group, location, storage_account for client, url in SERVICES.items(): # Act service = client( - self.account_url(storage_account.name, "queue"), credential=storage_account_key, queue_name='foo') + self.account_url(storage_account, "queue"), credential=storage_account_key, queue_name='foo') # Assert self.validate_standard_account_endpoints(service, url, storage_account.name, storage_account_key) @@ -72,7 +72,7 @@ def test_create_service_with_sas(self, resource_group, location, storage_account for service_type in SERVICES: # Act service = service_type( - self.account_url(storage_account.name, "queue"), credential=self.sas_token, queue_name='foo') + self.account_url(storage_account, "queue"), credential=self.sas_token, queue_name='foo') # Assert self.assertIsNotNone(service) @@ -86,7 +86,7 @@ def test_create_service_with_token(self, resource_group, location, storage_accou for service_type in SERVICES: # Act service = service_type( - self.account_url(storage_account.name, "queue"), credential=self.token_credential, queue_name='foo') + self.account_url(storage_account, "queue"), credential=self.token_credential, queue_name='foo') # Assert self.assertIsNotNone(service) @@ -101,7 +101,7 @@ def test_create_service_with_token_and_http(self, resource_group, location, stor for service_type in SERVICES: # Act with self.assertRaises(ValueError): - url = self.account_url(storage_account.name, "queue").replace('https', 'http') + url = self.account_url(storage_account, "queue").replace('https', 'http') service_type(url, credential=self.token_credential, queue_name='foo') @GlobalStorageAccountPreparer() @@ -110,7 +110,7 @@ def test_create_service_china(self, resource_group, location, storage_account, s for service_type in SERVICES.items(): # Act - url = self.account_url(storage_account.name, "queue").replace('core.windows.net', 'core.chinacloudapi.cn') + url = self.account_url(storage_account, "queue").replace('core.windows.net', 'core.chinacloudapi.cn') service = service_type[0]( url, credential=storage_account_key, queue_name='foo') @@ -130,7 +130,7 @@ def test_create_service_protocol(self, resource_group, location, storage_account for service_type in SERVICES.items(): # Act - url = self.account_url(storage_account.name, "queue").replace('https', 'http') + url = self.account_url(storage_account, "queue").replace('https', 'http') service = service_type[0]( url, credential=storage_account_key, queue_name='foo') @@ -158,9 +158,9 @@ def test_create_service_with_socket_timeout(self, resource_group, location, stor for service_type in SERVICES.items(): # Act default_service = service_type[0]( - self.account_url(storage_account.name, "queue"), credential=storage_account_key, queue_name='foo') + self.account_url(storage_account, "queue"), credential=storage_account_key, queue_name='foo') service = service_type[0]( - self.account_url(storage_account.name, "queue"), credential=storage_account_key, + self.account_url(storage_account, "queue"), credential=storage_account_key, queue_name='foo', connection_timeout=22) # Assert @@ -360,7 +360,7 @@ def test_create_service_with_custom_account_endpoint_path(self, resource_group, @GlobalStorageAccountPreparer() def test_request_callback_signed_header(self, resource_group, location, storage_account, storage_account_key): # Arrange - service = QueueServiceClient(self.account_url(storage_account.name, "queue"), credential=storage_account_key) + service = QueueServiceClient(self.account_url(storage_account, "queue"), credential=storage_account_key) name = self.get_resource_name('cont') # Act @@ -377,7 +377,7 @@ def test_request_callback_signed_header(self, resource_group, location, storage_ @GlobalStorageAccountPreparer() def test_response_callback(self, resource_group, location, storage_account, storage_account_key): # Arrange - service = QueueServiceClient(self.account_url(storage_account.name, "queue"), credential=storage_account_key) + service = QueueServiceClient(self.account_url(storage_account, "queue"), credential=storage_account_key) name = self.get_resource_name('cont') queue = service.get_queue_client(name) @@ -392,7 +392,7 @@ def callback(response): @GlobalStorageAccountPreparer() def test_user_agent_default(self, resource_group, location, storage_account, storage_account_key): - service = QueueServiceClient(self.account_url(storage_account.name, "queue"), credential=storage_account_key) + service = QueueServiceClient(self.account_url(storage_account, "queue"), credential=storage_account_key) def callback(response): self.assertTrue('User-Agent' in response.http_request.headers) @@ -409,7 +409,7 @@ def callback(response): def test_user_agent_custom(self, resource_group, location, storage_account, storage_account_key): custom_app = "TestApp/v1.0" service = QueueServiceClient( - self.account_url(storage_account.name, "queue"), credential=storage_account_key, user_agent=custom_app) + self.account_url(storage_account, "queue"), credential=storage_account_key, user_agent=custom_app) def callback(response): self.assertTrue('User-Agent' in response.http_request.headers) @@ -435,7 +435,7 @@ def callback(response): @GlobalStorageAccountPreparer() def test_user_agent_append(self, resource_group, location, storage_account, storage_account_key): - service = QueueServiceClient(self.account_url(storage_account.name, "queue"), credential=storage_account_key) + service = QueueServiceClient(self.account_url(storage_account, "queue"), credential=storage_account_key) def callback(response): self.assertTrue('User-Agent' in response.http_request.headers) @@ -452,7 +452,7 @@ def callback(response): @GlobalStorageAccountPreparer() def test_create_queue_client_with_complete_queue_url(self, resource_group, location, storage_account, storage_account_key): # Arrange - queue_url = self.account_url(storage_account.name, "queue") + "/foo" + queue_url = self.account_url(storage_account, "queue") + "/foo" service = QueueClient(queue_url, queue_name='bar', credential=storage_account_key) # Assert @@ -481,7 +481,7 @@ def test_closing_pipeline_client(self, resource_group, location, storage_account for client, url in SERVICES.items(): # Act service = client( - self.account_url(storage_account.name, "queue"), credential=storage_account_key, queue_name='queue') + self.account_url(storage_account, "queue"), credential=storage_account_key, queue_name='queue') # Assert with service: @@ -494,7 +494,7 @@ def test_closing_pipeline_client_simple(self, resource_group, location, storage_ for client, url in SERVICES.items(): # Act service = client( - self.account_url(storage_account.name, "queue"), credential=storage_account_key, queue_name='queue') + self.account_url(storage_account, "queue"), credential=storage_account_key, queue_name='queue') service.close() # ------------------------------------------------------------------------------ if __name__ == '__main__': diff --git a/sdk/storage/azure-storage-queue/tests/test_queue_client_async.py b/sdk/storage/azure-storage-queue/tests/test_queue_client_async.py index c7b08e8ef757..ea8702cc1231 100644 --- a/sdk/storage/azure-storage-queue/tests/test_queue_client_async.py +++ b/sdk/storage/azure-storage-queue/tests/test_queue_client_async.py @@ -61,7 +61,7 @@ def test_create_service_with_key(self, resource_group, location, storage_account for client, url in SERVICES.items(): # Act service = client( - self.account_url(storage_account.name, "queue"), credential=storage_account_key, queue_name='foo', transport=AiohttpTestTransport()) + self.account_url(storage_account, "queue"), credential=storage_account_key, queue_name='foo', transport=AiohttpTestTransport()) # Assert self.validate_standard_account_endpoints(service, url, storage_account, storage_account_key) @@ -86,7 +86,7 @@ def test_create_service_with_sas(self, resource_group, location, storage_account for service_type in SERVICES: # Act service = service_type( - self.account_url(storage_account.name, "queue"), credential=self.sas_token, queue_name='foo') + self.account_url(storage_account, "queue"), credential=self.sas_token, queue_name='foo') # Assert self.assertIsNotNone(service) @@ -100,7 +100,7 @@ def test_create_service_with_token(self, resource_group, location, storage_accou for service_type in SERVICES: # Act service = service_type( - self.account_url(storage_account.name, "queue"), credential=self.token_credential, queue_name='foo') + self.account_url(storage_account, "queue"), credential=self.token_credential, queue_name='foo') # Assert self.assertIsNotNone(service) @@ -115,7 +115,7 @@ def test_create_service_with_token_and_http(self, resource_group, location, stor for service_type in SERVICES: # Act with self.assertRaises(ValueError): - url = self.account_url(storage_account.name, "queue").replace('https', 'http') + url = self.account_url(storage_account, "queue").replace('https', 'http') service_type(url, credential=self.token_credential, queue_name='foo') @GlobalStorageAccountPreparer() @@ -124,7 +124,7 @@ def test_create_service_china(self, resource_group, location, storage_account, s for service_type in SERVICES.items(): # Act - url = self.account_url(storage_account.name, "queue").replace('core.windows.net', 'core.chinacloudapi.cn') + url = self.account_url(storage_account, "queue").replace('core.windows.net', 'core.chinacloudapi.cn') service = service_type[0]( url, credential=storage_account_key, queue_name='foo') @@ -144,7 +144,7 @@ def test_create_service_protocol(self, resource_group, location, storage_account for service_type in SERVICES.items(): # Act - url = self.account_url(storage_account.name, "queue").replace('https', 'http') + url = self.account_url(storage_account, "queue").replace('https', 'http') service = service_type[0]( url, credential=storage_account_key, queue_name='foo') @@ -172,9 +172,9 @@ def test_create_service_with_socket_timeout(self, resource_group, location, stor for service_type in SERVICES.items(): # Act default_service = service_type[0]( - self.account_url(storage_account.name, "queue"), credential=storage_account_key, queue_name='foo') + self.account_url(storage_account, "queue"), credential=storage_account_key, queue_name='foo') service = service_type[0]( - self.account_url(storage_account.name, "queue"), credential=storage_account_key, + self.account_url(storage_account, "queue"), credential=storage_account_key, queue_name='foo', connection_timeout=22) # Assert @@ -376,7 +376,7 @@ def test_create_service_with_custom_account_endpoint_path(self, resource_group, @AsyncStorageTestCase.await_prepared_test async def test_request_callback_signed_header(self, resource_group, location, storage_account, storage_account_key): # Arrange - service = QueueServiceClient(self.account_url(storage_account.name, "queue"), credential=storage_account_key) + service = QueueServiceClient(self.account_url(storage_account, "queue"), credential=storage_account_key) name = self.get_resource_name('cont') # Act @@ -395,7 +395,7 @@ async def test_request_callback_signed_header(self, resource_group, location, st @AsyncStorageTestCase.await_prepared_test async def test_response_callback(self, resource_group, location, storage_account, storage_account_key): # Arrange - service = QueueServiceClient(self.account_url(storage_account.name, "queue"), credential=storage_account_key, transport=AiohttpTestTransport()) + service = QueueServiceClient(self.account_url(storage_account, "queue"), credential=storage_account_key, transport=AiohttpTestTransport()) name = self.get_resource_name('cont') queue = service.get_queue_client(name) @@ -411,7 +411,7 @@ def callback(response): @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_user_agent_default(self, resource_group, location, storage_account, storage_account_key): - service = QueueServiceClient(self.account_url(storage_account.name, "queue"), credential=storage_account_key, transport=AiohttpTestTransport()) + service = QueueServiceClient(self.account_url(storage_account, "queue"), credential=storage_account_key, transport=AiohttpTestTransport()) def callback(response): self.assertTrue('User-Agent' in response.http_request.headers) @@ -429,7 +429,7 @@ def callback(response): async def test_user_agent_custom(self, resource_group, location, storage_account, storage_account_key): custom_app = "TestApp/v1.0" service = QueueServiceClient( - self.account_url(storage_account.name, "queue"), credential=storage_account_key, user_agent=custom_app, transport=AiohttpTestTransport()) + self.account_url(storage_account, "queue"), credential=storage_account_key, user_agent=custom_app, transport=AiohttpTestTransport()) def callback(response): self.assertTrue('User-Agent' in response.http_request.headers) @@ -456,7 +456,7 @@ def callback(response): @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_user_agent_append(self, resource_group, location, storage_account, storage_account_key): - service = QueueServiceClient(self.account_url(storage_account.name, "queue"), credential=storage_account_key, transport=AiohttpTestTransport()) + service = QueueServiceClient(self.account_url(storage_account, "queue"), credential=storage_account_key, transport=AiohttpTestTransport()) def callback(response): self.assertTrue('User-Agent' in response.http_request.headers) @@ -471,26 +471,28 @@ def callback(response): await service.get_service_properties(raw_response_hook=callback, headers=custom_headers) @GlobalStorageAccountPreparer() + @AsyncStorageTestCase.await_prepared_test async def test_closing_pipeline_client_async(self, resource_group, location, storage_account, storage_account_key): # Arrange for client, url in SERVICES.items(): # Act service = client( - self.account_url(storage_account.name, "queue"), credential=storage_account_key, queue_name='queue') + self.account_url(storage_account, "queue"), credential=storage_account_key, queue_name='queue') # Assert async with service: assert hasattr(service, 'close') - service.close() + await service.close() @GlobalStorageAccountPreparer() + @AsyncStorageTestCase.await_prepared_test async def test_closing_pipeline_client_simple_async(self, resource_group, location, storage_account, storage_account_key): # Arrange for client, url in SERVICES.items(): # Act service = client( - self.account_url(storage_account.name, "queue"), credential=storage_account_key, queue_name='queue') - service.close() + self.account_url(storage_account, "queue"), credential=storage_account_key, queue_name='queue') + await service.close() # ------------------------------------------------------------------------------ if __name__ == '__main__': diff --git a/sdk/storage/azure-storage-queue/tests/test_queue_encodings.py b/sdk/storage/azure-storage-queue/tests/test_queue_encodings.py index 9b0cfa9dbfab..f9314e778c73 100644 --- a/sdk/storage/azure-storage-queue/tests/test_queue_encodings.py +++ b/sdk/storage/azure-storage-queue/tests/test_queue_encodings.py @@ -62,7 +62,7 @@ def _validate_encoding(self, queue, message): @GlobalStorageAccountPreparer() def test_message_text_xml(self, resource_group, location, storage_account, storage_account_key): # Arrange. - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) message = u'' queue = qsc.get_queue_client(self.get_resource_name(TEST_QUEUE_PREFIX)) @@ -74,7 +74,7 @@ def test_message_text_xml(self, resource_group, location, storage_account, stora @GlobalStorageAccountPreparer() def test_message_text_xml_whitespace(self, resource_group, location, storage_account, storage_account_key): # Arrange. - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) message = u' mess\t age1\n' queue = qsc.get_queue_client(self.get_resource_name(TEST_QUEUE_PREFIX)) @@ -84,7 +84,7 @@ def test_message_text_xml_whitespace(self, resource_group, location, storage_acc @GlobalStorageAccountPreparer() def test_message_text_xml_invalid_chars(self, resource_group, location, storage_account, storage_account_key): # Action. - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue = self._get_queue_reference(qsc) message = u'\u0001' @@ -95,9 +95,9 @@ def test_message_text_xml_invalid_chars(self, resource_group, location, storage_ @GlobalStorageAccountPreparer() def test_message_text_base64(self, resource_group, location, storage_account, storage_account_key): # Arrange. - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue = QueueClient( - account_url=self.account_url(storage_account.name, "queue"), + account_url=self.account_url(storage_account, "queue"), queue_name=self.get_resource_name(TEST_QUEUE_PREFIX), credential=storage_account_key, message_encode_policy=TextBase64EncodePolicy(), @@ -111,9 +111,9 @@ def test_message_text_base64(self, resource_group, location, storage_account, st @GlobalStorageAccountPreparer() def test_message_bytes_base64(self, resource_group, location, storage_account, storage_account_key): # Arrange. - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue = QueueClient( - account_url=self.account_url(storage_account.name, "queue"), + account_url=self.account_url(storage_account, "queue"), queue_name=self.get_resource_name(TEST_QUEUE_PREFIX), credential=storage_account_key, message_encode_policy=BinaryBase64EncodePolicy(), @@ -128,7 +128,7 @@ def test_message_bytes_base64(self, resource_group, location, storage_account, s @GlobalStorageAccountPreparer() def test_message_bytes_fails(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue = qsc.get_queue_client(self.get_resource_name(TEST_QUEUE_PREFIX)) queue.create_queue() @@ -144,9 +144,9 @@ def test_message_bytes_fails(self, resource_group, location, storage_account, st @GlobalStorageAccountPreparer() def test_message_text_fails(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue = QueueClient( - account_url=self.account_url(storage_account.name, "queue"), + account_url=self.account_url(storage_account, "queue"), queue_name=self.get_resource_name(TEST_QUEUE_PREFIX), credential=storage_account_key, message_encode_policy=BinaryBase64EncodePolicy(), @@ -163,9 +163,9 @@ def test_message_text_fails(self, resource_group, location, storage_account, sto @GlobalStorageAccountPreparer() def test_message_base64_decode_fails(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue = QueueClient( - account_url=self.account_url(storage_account.name, "queue"), + account_url=self.account_url(storage_account, "queue"), queue_name=self.get_resource_name(TEST_QUEUE_PREFIX), credential=storage_account_key, message_encode_policy=None, diff --git a/sdk/storage/azure-storage-queue/tests/test_queue_encodings_async.py b/sdk/storage/azure-storage-queue/tests/test_queue_encodings_async.py index 841ccc2f58ee..176c9795e24b 100644 --- a/sdk/storage/azure-storage-queue/tests/test_queue_encodings_async.py +++ b/sdk/storage/azure-storage-queue/tests/test_queue_encodings_async.py @@ -79,7 +79,7 @@ async def _validate_encoding(self, queue, message): @AsyncStorageTestCase.await_prepared_test async def test_message_text_xml(self, resource_group, location, storage_account, storage_account_key): # Arrange. - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) message = u'' queue = qsc.get_queue_client(self.get_resource_name(TEST_QUEUE_PREFIX)) @@ -90,7 +90,7 @@ async def test_message_text_xml(self, resource_group, location, storage_account, @AsyncStorageTestCase.await_prepared_test async def test_message_text_xml_whitespace(self, resource_group, location, storage_account, storage_account_key): # Arrange. - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) message = u' mess\t age1\n' queue = qsc.get_queue_client(self.get_resource_name(TEST_QUEUE_PREFIX)) @@ -101,7 +101,7 @@ async def test_message_text_xml_whitespace(self, resource_group, location, stora @AsyncStorageTestCase.await_prepared_test async def test_message_text_xml_invalid_chars(self, resource_group, location, storage_account, storage_account_key): # Action. - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue = self._get_queue_reference(qsc) message = u'\u0001' @@ -113,9 +113,9 @@ async def test_message_text_xml_invalid_chars(self, resource_group, location, st @AsyncStorageTestCase.await_prepared_test async def test_message_text_base64(self, resource_group, location, storage_account, storage_account_key): # Arrange. - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue = QueueClient( - account_url=self.account_url(storage_account.name, "queue"), + account_url=self.account_url(storage_account, "queue"), queue_name=self.get_resource_name(TEST_QUEUE_PREFIX), credential=storage_account_key, message_encode_policy=TextBase64EncodePolicy(), @@ -131,9 +131,9 @@ async def test_message_text_base64(self, resource_group, location, storage_accou @AsyncStorageTestCase.await_prepared_test async def test_message_bytes_base64(self, resource_group, location, storage_account, storage_account_key): # Arrange. - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue = QueueClient( - account_url=self.account_url(storage_account.name, "queue"), + account_url=self.account_url(storage_account, "queue"), queue_name=self.get_resource_name(TEST_QUEUE_PREFIX), credential=storage_account_key, message_encode_policy=BinaryBase64EncodePolicy(), @@ -149,7 +149,7 @@ async def test_message_bytes_base64(self, resource_group, location, storage_acco @AsyncStorageTestCase.await_prepared_test async def test_message_bytes_fails(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue = self._get_queue_reference(qsc) # Action. with self.assertRaises(TypeError) as e: @@ -163,9 +163,9 @@ async def test_message_bytes_fails(self, resource_group, location, storage_accou @AsyncStorageTestCase.await_prepared_test async def test_message_text_fails(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue = QueueClient( - account_url=self.account_url(storage_account.name, "queue"), + account_url=self.account_url(storage_account, "queue"), queue_name=self.get_resource_name(TEST_QUEUE_PREFIX), credential=storage_account_key, message_encode_policy=BinaryBase64EncodePolicy(), @@ -184,9 +184,9 @@ async def test_message_text_fails(self, resource_group, location, storage_accoun @AsyncStorageTestCase.await_prepared_test async def test_message_base64_decode_fails(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) queue = QueueClient( - account_url=self.account_url(storage_account.name, "queue"), + account_url=self.account_url(storage_account, "queue"), queue_name=self.get_resource_name(TEST_QUEUE_PREFIX), credential=storage_account_key, message_encode_policy=None, diff --git a/sdk/storage/azure-storage-queue/tests/test_queue_encryption.py b/sdk/storage/azure-storage-queue/tests/test_queue_encryption.py index 740fa6a0933f..2d0758145484 100644 --- a/sdk/storage/azure-storage-queue/tests/test_queue_encryption.py +++ b/sdk/storage/azure-storage-queue/tests/test_queue_encryption.py @@ -74,7 +74,7 @@ def _create_queue(self, qsc, prefix=TEST_QUEUE_PREFIX, **kwargs): @GlobalStorageAccountPreparer() def test_get_messages_encrypted_kek(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) qsc.key_encryption_key = KeyWrapper('key1') queue = self._create_queue(qsc) queue.send_message(u'encrypted_message_2') @@ -88,7 +88,7 @@ def test_get_messages_encrypted_kek(self, resource_group, location, storage_acco @GlobalStorageAccountPreparer() def test_get_messages_encrypted_resolver(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) qsc.key_encryption_key = KeyWrapper('key1') queue = self._create_queue(qsc) queue.send_message(u'encrypted_message_2') @@ -106,7 +106,7 @@ def test_get_messages_encrypted_resolver(self, resource_group, location, storage @GlobalStorageAccountPreparer() def test_peek_messages_encrypted_kek(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) qsc.key_encryption_key = KeyWrapper('key1') queue = self._create_queue(qsc) queue.send_message(u'encrypted_message_3') @@ -120,7 +120,7 @@ def test_peek_messages_encrypted_kek(self, resource_group, location, storage_acc @GlobalStorageAccountPreparer() def test_peek_messages_encrypted_resolver(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) qsc.key_encryption_key = KeyWrapper('key1') queue = self._create_queue(qsc) queue.send_message(u'encrypted_message_4') @@ -143,7 +143,7 @@ def test_peek_messages_encrypted_kek_RSA(self, resource_group, location, storage # the playback test will fail due to a change in kek values. # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) qsc.key_encryption_key = RSAKeyWrapper('key2') queue = self._create_queue(qsc) queue.send_message(u'encrypted_message_3') @@ -159,7 +159,7 @@ def test_peek_messages_encrypted_kek_RSA(self, resource_group, location, storage def test_update_encrypted_message(self, resource_group, location, storage_account, storage_account_key): # TODO: Recording doesn't work # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue = self._create_queue(qsc) queue.key_encryption_key = KeyWrapper('key1') queue.send_message(u'Update Me') @@ -178,7 +178,7 @@ def test_update_encrypted_message(self, resource_group, location, storage_accoun @GlobalStorageAccountPreparer() def test_update_encrypted_binary_message(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue = self._create_queue(qsc, message_encode_policy=BinaryBase64EncodePolicy(), message_decode_policy=BinaryBase64DecodePolicy()) queue.key_encryption_key = KeyWrapper('key1') @@ -207,7 +207,7 @@ def test_update_encrypted_binary_message(self, resource_group, location, storage def test_update_encrypted_raw_text_message(self, resource_group, location, storage_account, storage_account_key): # TODO: Recording doesn't work # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue = self._create_queue(qsc, message_encode_policy=None, message_decode_policy=None) queue.key_encryption_key = KeyWrapper('key1') @@ -231,7 +231,7 @@ def test_update_encrypted_raw_text_message(self, resource_group, location, stora def test_update_encrypted_json_message(self, resource_group, location, storage_account, storage_account_key): # TODO: Recording doesn't work # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue = self._create_queue(qsc, message_encode_policy=None, message_decode_policy=None) queue.key_encryption_key = KeyWrapper('key1') @@ -256,7 +256,7 @@ def test_update_encrypted_json_message(self, resource_group, location, storage_a @GlobalStorageAccountPreparer() def test_invalid_value_kek_wrap(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue = self._create_queue(qsc) queue.key_encryption_key = KeyWrapper('key1') queue.key_encryption_key.get_kid = None @@ -279,7 +279,7 @@ def test_invalid_value_kek_wrap(self, resource_group, location, storage_account, @GlobalStorageAccountPreparer() def test_missing_attribute_kek_wrap(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue = self._create_queue(qsc) valid_key = KeyWrapper('key1') @@ -312,7 +312,7 @@ def test_missing_attribute_kek_wrap(self, resource_group, location, storage_acco @GlobalStorageAccountPreparer() def test_invalid_value_kek_unwrap(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue = self._create_queue(qsc) queue.key_encryption_key = KeyWrapper('key1') queue.send_message(u'message') @@ -329,7 +329,7 @@ def test_invalid_value_kek_unwrap(self, resource_group, location, storage_accoun @GlobalStorageAccountPreparer() def test_missing_attribute_kek_unrwap(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue = self._create_queue(qsc) queue.key_encryption_key = KeyWrapper('key1') queue.send_message(u'message') @@ -355,7 +355,7 @@ def test_missing_attribute_kek_unrwap(self, resource_group, location, storage_ac @GlobalStorageAccountPreparer() def test_validate_encryption(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue = self._create_queue(qsc) kek = KeyWrapper('key1') queue.key_encryption_key = kek @@ -414,7 +414,7 @@ def test_validate_encryption(self, resource_group, location, storage_account, st @GlobalStorageAccountPreparer() def test_put_with_strict_mode(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue = self._create_queue(qsc) kek = KeyWrapper('key1') queue.key_encryption_key = kek @@ -432,7 +432,7 @@ def test_put_with_strict_mode(self, resource_group, location, storage_account, s @GlobalStorageAccountPreparer() def test_get_with_strict_mode(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue = self._create_queue(qsc) queue.send_message(u'message') @@ -446,7 +446,7 @@ def test_get_with_strict_mode(self, resource_group, location, storage_account, s @GlobalStorageAccountPreparer() def test_encryption_add_encrypted_64k_message(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue = self._create_queue(qsc) message = u'a' * 1024 * 64 @@ -461,7 +461,7 @@ def test_encryption_add_encrypted_64k_message(self, resource_group, location, st @GlobalStorageAccountPreparer() def test_encryption_nonmatching_kid(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) queue = self._create_queue(qsc) queue.key_encryption_key = KeyWrapper('key1') queue.send_message(u'message') diff --git a/sdk/storage/azure-storage-queue/tests/test_queue_encryption_async.py b/sdk/storage/azure-storage-queue/tests/test_queue_encryption_async.py index 5ae500d926d0..8c455a743137 100644 --- a/sdk/storage/azure-storage-queue/tests/test_queue_encryption_async.py +++ b/sdk/storage/azure-storage-queue/tests/test_queue_encryption_async.py @@ -90,7 +90,7 @@ async def _create_queue(self, qsc, prefix=TEST_QUEUE_PREFIX, **kwargs): @AsyncStorageTestCase.await_prepared_test async def test_get_messages_encrypted_kek(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) qsc.key_encryption_key = KeyWrapper('key1') queue = await self._create_queue(qsc) await queue.send_message(u'encrypted_message_2') @@ -107,7 +107,7 @@ async def test_get_messages_encrypted_kek(self, resource_group, location, storag @AsyncStorageTestCase.await_prepared_test async def test_get_messages_encrypted_resolver(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) qsc.key_encryption_key = KeyWrapper('key1') queue = await self._create_queue(qsc) await queue.send_message(u'encrypted_message_2') @@ -127,7 +127,7 @@ async def test_get_messages_encrypted_resolver(self, resource_group, location, s @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_peek_messages_encrypted_kek(self, resource_group, location, storage_account, storage_account_key): - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) # Arrange qsc.key_encryption_key = KeyWrapper('key1') queue = await self._create_queue(qsc) @@ -142,7 +142,7 @@ async def test_peek_messages_encrypted_kek(self, resource_group, location, stora @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_peek_messages_encrypted_resolver(self, resource_group, location, storage_account, storage_account_key): - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) # Arrange qsc.key_encryption_key = KeyWrapper('key1') queue = await self._create_queue(qsc) @@ -162,7 +162,7 @@ async def test_peek_messages_encrypted_resolver(self, resource_group, location, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_peek_messages_encrypted_kek_RSA(self, resource_group, location, storage_account, storage_account_key): - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) # We can only generate random RSA keys, so this must be run live or # the playback test will fail due to a change in kek values. @@ -181,7 +181,7 @@ async def test_peek_messages_encrypted_kek_RSA(self, resource_group, location, s @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_update_encrypted_message(self, resource_group, location, storage_account, storage_account_key): - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) # TODO: Recording doesn't work # Arrange queue = await self._create_queue(qsc) @@ -206,7 +206,7 @@ async def test_update_encrypted_message(self, resource_group, location, storage_ @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_update_encrypted_binary_message(self, resource_group, location, storage_account, storage_account_key): - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) # Arrange queue = await self._create_queue(qsc, message_encode_policy=BinaryBase64EncodePolicy(), message_decode_policy=BinaryBase64DecodePolicy()) queue.key_encryption_key = KeyWrapper('key1') @@ -234,7 +234,7 @@ async def test_update_encrypted_binary_message(self, resource_group, location, s @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_update_encrypted_raw_text_message(self, resource_group, location, storage_account, storage_account_key): - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) # TODO: Recording doesn't work # Arrange queue = await self._create_queue(qsc, message_encode_policy=None, message_decode_policy=None) @@ -261,7 +261,7 @@ async def test_update_encrypted_raw_text_message(self, resource_group, location, @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_update_encrypted_json_message(self, resource_group, location, storage_account, storage_account_key): - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) # TODO: Recording doesn't work # Arrange queue = await self._create_queue(qsc, message_encode_policy=None, message_decode_policy=None) @@ -292,7 +292,7 @@ async def test_update_encrypted_json_message(self, resource_group, location, sto @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_invalid_value_kek_wrap(self, resource_group, location, storage_account, storage_account_key): - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) # Arrange queue = await self._create_queue(qsc) queue.key_encryption_key = KeyWrapper('key1') @@ -316,7 +316,7 @@ async def test_invalid_value_kek_wrap(self, resource_group, location, storage_ac @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_missing_attribute_kek_wrap(self, resource_group, location, storage_account, storage_account_key): - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) # Arrange queue = await self._create_queue(qsc) @@ -350,7 +350,7 @@ async def test_missing_attribute_kek_wrap(self, resource_group, location, storag @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_invalid_value_kek_unwrap(self, resource_group, location, storage_account, storage_account_key): - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) # Arrange queue = await self._create_queue(qsc) queue.key_encryption_key = KeyWrapper('key1') @@ -368,7 +368,7 @@ async def test_invalid_value_kek_unwrap(self, resource_group, location, storage_ @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_missing_attribute_kek_unrwap(self, resource_group, location, storage_account, storage_account_key): - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) # Arrange queue = await self._create_queue(qsc) queue.key_encryption_key = KeyWrapper('key1') @@ -395,7 +395,7 @@ async def test_missing_attribute_kek_unrwap(self, resource_group, location, stor @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_validate_encryption(self, resource_group, location, storage_account, storage_account_key): - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) # Arrange queue = await self._create_queue(qsc) kek = KeyWrapper('key1') @@ -455,7 +455,7 @@ async def test_validate_encryption(self, resource_group, location, storage_accou @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_put_with_strict_mode(self, resource_group, location, storage_account, storage_account_key): - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) # Arrange queue = await self._create_queue(qsc) kek = KeyWrapper('key1') @@ -474,7 +474,7 @@ async def test_put_with_strict_mode(self, resource_group, location, storage_acco @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_get_with_strict_mode(self, resource_group, location, storage_account, storage_account_key): - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) # Arrange queue = await self._create_queue(qsc) await queue.send_message(u'message') @@ -491,7 +491,7 @@ async def test_get_with_strict_mode(self, resource_group, location, storage_acco @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_encryption_add_encrypted_64k_message(self, resource_group, location, storage_account, storage_account_key): - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) # Arrange queue = await self._create_queue(qsc) message = u'a' * 1024 * 64 @@ -507,7 +507,7 @@ async def test_encryption_add_encrypted_64k_message(self, resource_group, locati @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test async def test_encryption_nonmatching_kid(self, resource_group, location, storage_account, storage_account_key): - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) # Arrange queue = await self._create_queue(qsc) queue.key_encryption_key = KeyWrapper('key1') diff --git a/sdk/storage/azure-storage-queue/tests/test_queue_service_properties.py b/sdk/storage/azure-storage-queue/tests/test_queue_service_properties.py index 7e2b0e9f9a6e..22e216a28c04 100644 --- a/sdk/storage/azure-storage-queue/tests/test_queue_service_properties.py +++ b/sdk/storage/azure-storage-queue/tests/test_queue_service_properties.py @@ -106,7 +106,7 @@ def _assert_retention_equal(self, ret1, ret2): @GlobalStorageAccountPreparer() def test_queue_service_properties(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) # Act resp = qsc.set_service_properties( analytics_logging=QueueAnalyticsLogging(), @@ -124,7 +124,7 @@ def test_queue_service_properties(self, resource_group, location, storage_accoun @GlobalStorageAccountPreparer() def test_set_logging(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) logging = QueueAnalyticsLogging(read=True, write=True, delete=True, retention_policy=RetentionPolicy(enabled=True, days=5)) # Act @@ -137,7 +137,7 @@ def test_set_logging(self, resource_group, location, storage_account, storage_ac @GlobalStorageAccountPreparer() def test_set_hour_metrics(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) hour_metrics = Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=5)) # Act @@ -150,7 +150,7 @@ def test_set_hour_metrics(self, resource_group, location, storage_account, stora @GlobalStorageAccountPreparer() def test_set_minute_metrics(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) minute_metrics = Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=5)) @@ -164,7 +164,7 @@ def test_set_minute_metrics(self, resource_group, location, storage_account, sto @GlobalStorageAccountPreparer() def test_set_cors(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) cors_rule1 = CorsRule(['www.xyz.com'], ['GET']) allowed_origins = ['www.xyz.com', "www.ab.com", "www.bc.com"] @@ -199,7 +199,7 @@ def test_retention_no_days(self, resource_group, location, storage_account, stor @GlobalStorageAccountPreparer() def test_too_many_cors_rules(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) cors = [] for i in range(0, 6): cors.append(CorsRule(['www.xyz.com'], ['GET'])) @@ -211,7 +211,7 @@ def test_too_many_cors_rules(self, resource_group, location, storage_account, st @GlobalStorageAccountPreparer() def test_retention_too_long(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) minute_metrics = Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=366)) diff --git a/sdk/storage/azure-storage-queue/tests/test_queue_service_properties_async.py b/sdk/storage/azure-storage-queue/tests/test_queue_service_properties_async.py index b25accb63249..b05189bcdbcc 100644 --- a/sdk/storage/azure-storage-queue/tests/test_queue_service_properties_async.py +++ b/sdk/storage/azure-storage-queue/tests/test_queue_service_properties_async.py @@ -120,7 +120,7 @@ def _assert_retention_equal(self, ret1, ret2): @AsyncStorageTestCase.await_prepared_test async def test_queue_service_properties(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) # Act resp = await qsc.set_service_properties( @@ -139,7 +139,7 @@ async def test_queue_service_properties(self, resource_group, location, storage_ @AsyncStorageTestCase.await_prepared_test async def test_set_logging(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) logging = QueueAnalyticsLogging(read=True, write=True, delete=True, retention_policy=RetentionPolicy(enabled=True, days=5)) # Act @@ -153,7 +153,7 @@ async def test_set_logging(self, resource_group, location, storage_account, stor @AsyncStorageTestCase.await_prepared_test async def test_set_hour_metrics(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) hour_metrics = Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=5)) # Act @@ -167,7 +167,7 @@ async def test_set_hour_metrics(self, resource_group, location, storage_account, @AsyncStorageTestCase.await_prepared_test async def test_set_minute_metrics(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) minute_metrics = Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=5)) @@ -182,7 +182,7 @@ async def test_set_minute_metrics(self, resource_group, location, storage_accoun @AsyncStorageTestCase.await_prepared_test async def test_set_cors(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) cors_rule1 = CorsRule(['www.xyz.com'], ['GET']) allowed_origins = ['www.xyz.com', "www.ab.com", "www.bc.com"] @@ -212,7 +212,7 @@ async def test_set_cors(self, resource_group, location, storage_account, storage @AsyncStorageTestCase.await_prepared_test async def test_retention_no_days(self, resource_group, location, storage_account, storage_account_key): # Assert - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) self.assertRaises(ValueError, RetentionPolicy, True, None) @@ -221,7 +221,7 @@ async def test_retention_no_days(self, resource_group, location, storage_account @AsyncStorageTestCase.await_prepared_test async def test_too_many_cors_rules(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) cors = [] for _ in range(0, 6): cors.append(CorsRule(['www.xyz.com'], ['GET'])) @@ -234,7 +234,7 @@ async def test_too_many_cors_rules(self, resource_group, location, storage_accou @AsyncStorageTestCase.await_prepared_test async def test_retention_too_long(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) minute_metrics = Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=366)) diff --git a/sdk/storage/azure-storage-queue/tests/test_queue_service_stats.py b/sdk/storage/azure-storage-queue/tests/test_queue_service_stats.py index b72e730fa2bc..363b1d1702f0 100644 --- a/sdk/storage/azure-storage-queue/tests/test_queue_service_stats.py +++ b/sdk/storage/azure-storage-queue/tests/test_queue_service_stats.py @@ -49,7 +49,7 @@ def override_response_body_with_live_status(response): @StorageAccountPreparer(name_prefix='pyacrstorage', sku='Standard_RAGRS', random_name_enabled=True) def test_queue_service_stats_f(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) # Act stats = qsc.get_service_stats(raw_response_hook=self.override_response_body_with_live_status) @@ -60,7 +60,7 @@ def test_queue_service_stats_f(self, resource_group, location, storage_account, @StorageAccountPreparer(name_prefix='pyacrstorage', sku='Standard_RAGRS', random_name_enabled=True) def test_queue_service_stats_when_unavailable(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key) # Act stats = qsc.get_service_stats( diff --git a/sdk/storage/azure-storage-queue/tests/test_queue_service_stats_async.py b/sdk/storage/azure-storage-queue/tests/test_queue_service_stats_async.py index 37fd0646de26..101632e7b1ff 100644 --- a/sdk/storage/azure-storage-queue/tests/test_queue_service_stats_async.py +++ b/sdk/storage/azure-storage-queue/tests/test_queue_service_stats_async.py @@ -64,7 +64,7 @@ def override_response_body_with_live_status(response): @AsyncStorageTestCase.await_prepared_test async def test_queue_service_stats_f(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) # Act stats = await qsc.get_service_stats(raw_response_hook=self.override_response_body_with_live_status) @@ -76,7 +76,7 @@ async def test_queue_service_stats_f(self, resource_group, location, storage_acc @AsyncStorageTestCase.await_prepared_test async def test_queue_service_stats_when_unavailable(self, resource_group, location, storage_account, storage_account_key): # Arrange - qsc = QueueServiceClient(self.account_url(storage_account.name, "queue"), storage_account_key, transport=AiohttpTestTransport()) + qsc = QueueServiceClient(self.account_url(storage_account, "queue"), storage_account_key, transport=AiohttpTestTransport()) # Act stats = await qsc.get_service_stats( diff --git a/tools/azure-sdk-tools/devtools_testutils/azure_testcase.py b/tools/azure-sdk-tools/devtools_testutils/azure_testcase.py index 612077659770..2804ac86a249 100644 --- a/tools/azure-sdk-tools/devtools_testutils/azure_testcase.py +++ b/tools/azure-sdk-tools/devtools_testutils/azure_testcase.py @@ -121,7 +121,11 @@ def get_settings_value(self, key): raise ValueError("You have both AZURE_{key} env variable and mgmt_settings_real.py for {key} to difference values".format(key=key)) if not key_value: - key_value = getattr(self.settings, key) + try: + key_value = getattr(self.settings, key) + except Exception: + print("Could not get {}".format(key)) + raise return key_value def set_value_to_scrub(self, key, default_value): diff --git a/tools/azure-sdk-tools/devtools_testutils/resource_testcase.py b/tools/azure-sdk-tools/devtools_testutils/resource_testcase.py index cfd0a8f39778..3d1f150d3825 100644 --- a/tools/azure-sdk-tools/devtools_testutils/resource_testcase.py +++ b/tools/azure-sdk-tools/devtools_testutils/resource_testcase.py @@ -1,3 +1,8 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- from collections import namedtuple import os diff --git a/tools/azure-sdk-tools/devtools_testutils/storage_testcase.py b/tools/azure-sdk-tools/devtools_testutils/storage_testcase.py index 0fb01d875846..d1afd0710dc8 100644 --- a/tools/azure-sdk-tools/devtools_testutils/storage_testcase.py +++ b/tools/azure-sdk-tools/devtools_testutils/storage_testcase.py @@ -1,7 +1,13 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- from collections import namedtuple import os from azure.mgmt.storage import StorageManagementClient +from azure.mgmt.storage.models import StorageAccount, Endpoints from azure_devtools.scenario_tests.preparers import ( AbstractPreparer, @@ -15,7 +21,6 @@ FakeStorageAccount = FakeResource - # Storage Account Preparer and its shorthand decorator class StorageAccountPreparer(AzureMgmtPreparer): @@ -67,11 +72,29 @@ def create_resource(self, name, **kwargs): self.resource_moniker ) else: - self.resource = FakeResource(name=name, id=name) + self.resource = StorageAccount( + location=self.location, + ) + self.resource.name = name + self.resource.id = name + self.resource.primary_endpoints = Endpoints() + self.resource.primary_endpoints.blob = 'https://{}.{}.core.windows.net'.format(name, 'blob') + self.resource.primary_endpoints.queue = 'https://{}.{}.core.windows.net'.format(name, 'queue') + self.resource.primary_endpoints.table = 'https://{}.{}.core.windows.net'.format(name, 'table') + self.resource.primary_endpoints.file = 'https://{}.{}.core.windows.net'.format(name, 'file') self.storage_key = 'ZmFrZV9hY29jdW50X2tleQ==' return { self.parameter_name: self.resource, '{}_key'.format(self.parameter_name): self.storage_key, + '{}_cs'.format(self.parameter_name): ";".join([ + "DefaultEndpointsProtocol=https", + "AccountName={}".format(name), + "AccountKey={}".format(self.storage_key), + "BlobEndpoint={}".format(self.resource.primary_endpoints.blob), + "TableEndpoint={}".format(self.resource.primary_endpoints.table), + "QueueEndpoint={}".format(self.resource.primary_endpoints.queue), + "FileEndpoint={}".format(self.resource.primary_endpoints.file), + ]) } def remove_resource(self, name, **kwargs):