diff --git a/.vscode/cspell.json b/.vscode/cspell.json index c4b5b0967b70..405956c66227 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -103,6 +103,7 @@ "sdk/eventhub/azure-eventhub-checkpointstoreblob/azure/eventhub/extensions/checkpointstoreblob/_vendor/**", "sdk/eventhub/azure-eventhub-checkpointstoreblob-aio/azure/eventhub/extensions/checkpointstoreblobaio/_vendor/**", "sdk/storage/azure-storage-extensions/**", + "sdk/storage/azure-storage-file-datalake/tests/**", "sdk/projects/azure-projects/tests/test_infra/**", "sdk/projects/azure-projects/samples/**/*.html", "sdk/projects/azure-projects/azure/projects/resources/**/types.py", diff --git a/eng/tools/azure-sdk-tools/devtools_testutils/__init__.py b/eng/tools/azure-sdk-tools/devtools_testutils/__init__.py index 51dfd8ff66a1..8b4e136b390b 100644 --- a/eng/tools/azure-sdk-tools/devtools_testutils/__init__.py +++ b/eng/tools/azure-sdk-tools/devtools_testutils/__init__.py @@ -16,7 +16,7 @@ ) # cSpell:disable -from .envvariable_loader import EnvironmentVariableLoader +from .envvariable_loader import EnvironmentVariableLoader, EnvironmentVariableOptions from .exceptions import AzureTestError, ReservedResourceNameError from .proxy_fixtures import environment_variables, recorded_test, variable_recorder from .proxy_startup import start_test_proxy, stop_test_proxy, test_proxy @@ -103,6 +103,7 @@ "PemCertificate", "PowerShellPreparer", "EnvironmentVariableLoader", + "EnvironmentVariableOptions", "environment_variables", "recorded_by_proxy", "RecordedTransport", diff --git a/eng/tools/azure-sdk-tools/devtools_testutils/envvariable_loader.py b/eng/tools/azure-sdk-tools/devtools_testutils/envvariable_loader.py index bdb715800898..fa46dd7a4231 100644 --- a/eng/tools/azure-sdk-tools/devtools_testutils/envvariable_loader.py +++ b/eng/tools/azure-sdk-tools/devtools_testutils/envvariable_loader.py @@ -5,6 +5,7 @@ # -------------------------------------------------------------------------- import logging import os +from typing import Optional from dotenv import load_dotenv, find_dotenv @@ -16,7 +17,41 @@ _logger = logging.getLogger(__name__) +class EnvironmentVariableOptions: + """ + Options for the EnvironmentVariableLoader. + + :param hide_secrets: Case insensitive list of environment variable names whose values should be hidden. Instead of + being passed to tests as plain strings, these values will be wrapped in an EnvironmentVariable object that hides + the value when printed. Use `.secret` to get the actual value (and don't store the value in a local variable). + """ + + def __init__(self, *, hide_secrets: Optional[list[str]] = None) -> None: + # Store all names as lowercase for easier case insensitive comparison in EnvironmentVariableLoader + self.hide_secrets: list[str] = [name.lower() for name in hide_secrets] if hide_secrets else [] + + class EnvironmentVariableLoader(AzureMgmtPreparer): + """ + Preparer to load environment variables during test setup. + + Refer to + https://github.com/Azure/azure-sdk-for-python/tree/main/eng/tools/azure-sdk-tools/devtools_testutils#use-the-environmentvariableloader + for usage information. + + :param str directory: The service directory prefix for the environment variables; e.g. "keyvault". + :param str name_prefix: Not used; present for compatibility with other preparers. + :param bool disable_recording: Not used; present for compatibility with other preparers. + :param dict client_kwargs: Not used; present for compatibility with other preparers. + :param bool random_name_enabled: Not used; present for compatibility with other preparers. + :param bool use_cache: Not used; present for compatibility with other preparers. + :param list preparers: Not used; present for compatibility with other preparers. + + :param options: An EnvironementVariableOptions object containing additional options for the preparer. + :param kwargs: Keyword arguments representing environment variable names and their fake values for use in + recordings. For example, `client_id="fake_client_id"`. + """ + def __init__( self, directory, @@ -26,6 +61,8 @@ def __init__( random_name_enabled=False, use_cache=True, preparers=None, + *, + options: Optional[EnvironmentVariableOptions] = None, **kwargs, ): super(EnvironmentVariableLoader, self).__init__( @@ -37,18 +74,30 @@ def __init__( ) self.directory = directory + self.hide_secrets = options.hide_secrets if options else [] self.fake_values = {} self.real_values = {} self._set_secrets(**kwargs) self._backup_preparers = preparers def _set_secrets(self, **kwargs): - keys = kwargs.keys() + keys = {key.lower() for key in kwargs.keys()} + if self.hide_secrets and not all(name in keys for name in self.hide_secrets): + missing = [name for name in self.hide_secrets if name not in keys] + raise AzureTestError( + f"The following environment variables were specified to be hidden, but no fake values were " + f"provided for them: {', '.join(missing)}. Please provide fake values for these variables." + ) + needed_keys = [] for key in keys: if self.directory in key: needed_keys.append(key) - self.fake_values[key] = kwargs[key] + # Store the fake value, wrapping in EnvironmentVariable if it should be hidden + # Even fake values can cause security alerts if they're formatted like real secrets + self.fake_values[key] = ( + EnvironmentVariable(key.upper(), kwargs[key]) if key in self.hide_secrets else kwargs[key] + ) for key in self.fake_values: kwargs.pop(key) @@ -96,6 +145,12 @@ def _set_mgmt_settings_real_values(self): os.environ.pop("AZURE_CLIENT_SECRET", None) def create_resource(self, name, **kwargs): + """ + Fetches required environment variables if running live; otherwise returns fake values. + + "create_resource" name is misleading, but is left over from when preparers were mostly used to create test + resources at runtime. + """ load_dotenv(find_dotenv()) if self.is_live: @@ -105,26 +160,23 @@ def create_resource(self, name, **kwargs): scrubbed_value = self.fake_values[key] if scrubbed_value: - self.real_values[key.lower()] = os.environ[key.upper()] + # Store the real value, wrapping in EnvironmentVariable if it should be hidden + self.real_values[key.lower()] = ( + EnvironmentVariable(key.upper(), os.environ[key.upper()]) + if key in self.hide_secrets + else os.environ[key.upper()] + ) - # vcrpy-based tests have a scrubber to register fake values - if hasattr(self.test_class_instance, "scrubber"): - self.test_class_instance.scrubber.register_name_pair( - self.real_values[key.lower()], scrubbed_value + try: + add_general_string_sanitizer( + value=scrubbed_value, + target=self.real_values[key], + ) + except: + _logger.info( + "A sanitizer could not be registered with the test proxy, so the " + f"EnvironmentVariableLoader will not scrub the value of {key} in recordings." ) - # test proxy tests have no scrubber, and instead register sanitizers using fake values - else: - try: - add_general_string_sanitizer( - value=scrubbed_value, - target=self.real_values[key.lower()], - ) - except: - _logger.info( - "This test class instance has no scrubber and a sanitizer could not be registered " - "with the test proxy, so the EnvironmentVariableLoader will not scrub the value of " - f"{key} in recordings." - ) else: raise AzureTestError( "To pass a live ID you must provide the scrubbed value for recordings to prevent secrets " @@ -152,3 +204,12 @@ def create_resource(self, name, **kwargs): def remove_resource(self, name, **kwargs): pass + + +class EnvironmentVariable: + def __init__(self, name: str, secret: str) -> None: + self.name = name + self.secret = secret + + def __str__(self): + return f"Environment variable {self.name}'s value hidden for security." diff --git a/sdk/storage/azure-storage-blob-changefeed/tests/settings/testcase.py b/sdk/storage/azure-storage-blob-changefeed/tests/settings/testcase.py index a4fd733200c3..c1855c9f83f0 100644 --- a/sdk/storage/azure-storage-blob-changefeed/tests/settings/testcase.py +++ b/sdk/storage/azure-storage-blob-changefeed/tests/settings/testcase.py @@ -13,7 +13,7 @@ import mock import logging -from devtools_testutils import PowerShellPreparer +from devtools_testutils import EnvironmentVariableLoader, EnvironmentVariableOptions from devtools_testutils.fake_credentials import STORAGE_ACCOUNT_FAKE_KEY try: @@ -43,9 +43,10 @@ os.environ['ACCOUNT_URL_SUFFIX'] = ACCOUNT_URL_SUFFIX ChangeFeedPreparer = functools.partial( - PowerShellPreparer, "storage", + EnvironmentVariableLoader, "storage", storage_account_name="storagename", storage_account_key=STORAGE_ACCOUNT_FAKE_KEY, + options=EnvironmentVariableOptions(hide_secrets=["storage_account_key"]), ) def not_for_emulator(test): diff --git a/sdk/storage/azure-storage-blob-changefeed/tests/test_change_feed.py b/sdk/storage/azure-storage-blob-changefeed/tests/test_change_feed.py index 32f57c02459e..297f4ee48659 100644 --- a/sdk/storage/azure-storage-blob-changefeed/tests/test_change_feed.py +++ b/sdk/storage/azure-storage-blob-changefeed/tests/test_change_feed.py @@ -33,7 +33,7 @@ def test_get_change_feed_events_by_page(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - cf_client = ChangeFeedClient(self.account_url(storage_account_name, "blob"), storage_account_key) + cf_client = ChangeFeedClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) results_per_page = 10 change_feed = cf_client.list_changes(results_per_page=results_per_page).by_page() @@ -69,7 +69,7 @@ def test_get_all_change_feed_events(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - cf_client = ChangeFeedClient(self.account_url(storage_account_name, "blob"), storage_account_key) + cf_client = ChangeFeedClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) change_feed = cf_client.list_changes() all_events = list(change_feed) total_events = len(all_events) @@ -93,7 +93,7 @@ def test_get_change_feed_events_with_continuation_token(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - cf_client = ChangeFeedClient(self.account_url(storage_account_name, "blob"), storage_account_key) + cf_client = ChangeFeedClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) # To get the total events number start_time = datetime(2022, 11, 15) end_time = datetime(2022, 11, 18) @@ -122,7 +122,7 @@ def test_get_change_feed_events_in_a_time_range(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - cf_client = ChangeFeedClient(self.account_url(storage_account_name, "blob"), storage_account_key) + cf_client = ChangeFeedClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) start_time = datetime(2022, 11, 15) end_time = datetime(2022, 11, 18) change_feed = cf_client.list_changes(start_time=start_time, end_time=end_time, results_per_page=2).by_page() @@ -138,7 +138,7 @@ def test_change_feed_does_not_fail_on_empty_event_stream(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - cf_client = ChangeFeedClient(self.account_url(storage_account_name, "blob"), storage_account_key) + cf_client = ChangeFeedClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) start_time = datetime(2300, 1, 1) change_feed = cf_client.list_changes(start_time=start_time) @@ -151,7 +151,7 @@ def test_read_change_feed_tail_where_3_shards_have_data(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - cf_client = ChangeFeedClient(self.account_url(storage_account_name, "blob"), storage_account_key) + cf_client = ChangeFeedClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) start_time = datetime(2022, 11, 27) end_time = datetime(2022, 11, 29) @@ -210,7 +210,7 @@ def test_read_change_feed_tail_where_only_1_shard_has_data(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - cf_client = ChangeFeedClient(self.account_url(storage_account_name, "blob"), storage_account_key) + cf_client = ChangeFeedClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) start_time = datetime(2022, 11, 27) end_time = datetime(2022, 11, 29) @@ -248,7 +248,7 @@ def test_read_change_feed_with_3_shards_in_a_time_range(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - cf_client = ChangeFeedClient(self.account_url(storage_account_name, "blob"), storage_account_key) + cf_client = ChangeFeedClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) # to get continuation token start_time = datetime(2022, 11, 27) @@ -280,7 +280,7 @@ def test_read_change_feed_with_3_shards_in_a_time_range(self, **kwargs): def test_read_3_shards_change_feed_during_a_time_range_in_multiple_times_gives_same_result_as_reading_all(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - cf_client = ChangeFeedClient(self.account_url(storage_account_name, "blob"), storage_account_key) + cf_client = ChangeFeedClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) # to read until the end start_time = datetime(2022, 11, 27) @@ -344,7 +344,7 @@ def test_list_3_shards_events_works_with_1_shard_cursor(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - cf_client = ChangeFeedClient(self.account_url(storage_account_name, "blob"), storage_account_key) + cf_client = ChangeFeedClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) start_time = datetime(2022, 11, 27) end_time = datetime(2022, 11, 29) change_feed = cf_client.list_changes(results_per_page=1, start_time=start_time, end_time=end_time).by_page() diff --git a/sdk/storage/azure-storage-blob/tests/settings/testcase.py b/sdk/storage/azure-storage-blob/tests/settings/testcase.py index 468dde0b667b..a9a6806247d9 100644 --- a/sdk/storage/azure-storage-blob/tests/settings/testcase.py +++ b/sdk/storage/azure-storage-blob/tests/settings/testcase.py @@ -9,7 +9,7 @@ import functools import os import logging -from devtools_testutils import PowerShellPreparer +from devtools_testutils import EnvironmentVariableLoader, EnvironmentVariableOptions from devtools_testutils.fake_credentials import STORAGE_ACCOUNT_FAKE_KEY try: @@ -47,7 +47,7 @@ os.environ['ACCOUNT_URL_SUFFIX'] = ACCOUNT_URL_SUFFIX BlobPreparer = functools.partial( - PowerShellPreparer, "storage", + EnvironmentVariableLoader, "storage", storage_account_name="storagename", storage_account_key=STORAGE_ACCOUNT_FAKE_KEY, secondary_storage_account_name="pyrmtstoragestorname", @@ -60,7 +60,17 @@ premium_storage_account_key=STORAGE_ACCOUNT_FAKE_KEY, soft_delete_storage_account_name="storagesoftdelname", soft_delete_storage_account_key=STORAGE_ACCOUNT_FAKE_KEY, - storage_resource_group_name="rgname" + storage_resource_group_name="rgname", + options=EnvironmentVariableOptions( + hide_secrets=[ + "storage_account_key", + "secondary_storage_account_key", + "blob_storage_account_key", + "versioned_storage_account_key", + "premium_storage_account_key", + "soft_delete_storage_account_key" + ] + ), ) 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 56d456ce4f51..fe6ac75ade5e 100644 --- a/sdk/storage/azure-storage-blob/tests/test_append_blob.py +++ b/sdk/storage/azure-storage-blob/tests/test_append_blob.py @@ -88,7 +88,7 @@ def test_create_blob(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob_name = self._get_blob_reference() @@ -111,7 +111,7 @@ def test_get_blob_properties_using_vid(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(versioned_storage_account_name, "blob"), - versioned_storage_account_key, + versioned_storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) @@ -137,7 +137,7 @@ def test_create_blob_with_lease_id(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) @@ -157,7 +157,7 @@ def test_create_blob_with_metadata(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) metadata = {'hello': 'world', 'number': '42'} blob_name = self._get_blob_reference() @@ -176,7 +176,7 @@ def test_append_block(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) @@ -197,7 +197,7 @@ def test_append_block_high_throughput(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key, max_block_size=100 * 1024 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret, max_block_size=100 * 1024 * 1024) self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_bytes(5 * 1024) @@ -215,7 +215,7 @@ def test_append_block_unicode(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) @@ -234,7 +234,7 @@ def test_append_block_with_if_tags(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key, + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) tags = {"tag1 name": "my tag", "tag2": "secondtag", "tag3": "thirdtag"} @@ -254,7 +254,7 @@ def test_append_block_with_md5(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) @@ -274,7 +274,7 @@ def test_append_block_from_url_with_oauth(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) source_blob_client = self._create_source_blob(source_blob_data, bsc) @@ -296,7 +296,7 @@ def test_append_block_from_url(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, 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) @@ -357,7 +357,7 @@ def test_append_block_from_url_and_validate_content_md5(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, 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) @@ -402,7 +402,7 @@ def test_append_block_from_url_with_source_if_modified(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, 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_unmodified(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, 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) @@ -502,7 +502,7 @@ def test_append_block_from_url_with_source_if_match(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, 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) @@ -552,7 +552,7 @@ def test_append_block_from_url_with_source_if_none_match(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, 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) @@ -602,7 +602,7 @@ def test_append_block_from_url_with_if_match(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, 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) @@ -655,7 +655,7 @@ def test_append_block_from_url_with_if_none_match(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, 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) @@ -703,7 +703,7 @@ def test_append_block_from_url_with_maxsize_condition(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, 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) @@ -750,7 +750,7 @@ def test_append_block_from_url_with_appendpos_condition(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, 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) @@ -797,7 +797,7 @@ def test_append_block_from_url_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, 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) @@ -846,7 +846,7 @@ def test_append_block_from_url_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, 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) @@ -894,7 +894,7 @@ def test_create_append_blob_with_no_overwrite(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob_name = self._get_blob_reference() blob = bsc.get_blob_client( @@ -933,7 +933,7 @@ def test_create_append_blob_with_overwrite(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob_name = self._get_blob_reference() blob = bsc.get_blob_client( @@ -970,7 +970,7 @@ def test_append_blob_from_bytes(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) @@ -990,7 +990,7 @@ def test_append_blob_from_0_bytes(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) @@ -1010,7 +1010,7 @@ def test_append_blob_from_bytes_with_progress(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) data = b'abcdefghijklmnopqrstuvwxyz' @@ -1035,7 +1035,7 @@ def test_append_blob_from_bytes_with_index(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) @@ -1052,7 +1052,7 @@ def test_append_blob_from_bytes_with_index_and_count(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) @@ -1069,7 +1069,7 @@ def test_append_blob_from_bytes_chunked_upload(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1089,7 +1089,7 @@ def test_append_blob_from_bytes_with_progress_chunked_upload(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1120,7 +1120,7 @@ def test_append_blob_from_bytes_chunked_upload_with_index_and_count(self, **kwar storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1139,7 +1139,7 @@ def test_append_blob_from_path_chunked_upload(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1163,7 +1163,7 @@ def test_append_blob_from_path_with_progress_chunked_upload(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1199,7 +1199,7 @@ def test_append_blob_from_stream_chunked_upload(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1222,7 +1222,7 @@ def test_app_blob_from_stream_nonseekable_chnked_upload_known_size(self, **kwarg storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1244,7 +1244,7 @@ def test_app_blob_from_stream_nonseekable_chnked_upload_unk_size(self, **kwargs) storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1265,7 +1265,7 @@ def test_append_blob_from_stream_with_multiple_appends(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1290,7 +1290,7 @@ def test_append_blob_from_stream_chunked_upload_with_count(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1312,7 +1312,7 @@ def test_append_blob_from_stream_chunked_upload_with_count_parallel(self, **kwar storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1336,7 +1336,7 @@ def test_append_blob_from_text(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) text = u'hello 啊齄丂狛狜 world' @@ -1357,7 +1357,7 @@ def test_append_blob_from_text_with_encoding(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) text = u'hello 啊齄丂狛狜 world' @@ -1375,7 +1375,7 @@ def test_append_blob_from_text_with_encoding_and_progress(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) text = u'hello 啊齄丂狛狜 world' @@ -1400,7 +1400,7 @@ def test_append_blob_from_text_chunked_upload(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_text_data(LARGE_BLOB_SIZE) @@ -1418,7 +1418,7 @@ def test_append_blob_with_md5(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) data = b'hello world' @@ -1434,7 +1434,7 @@ def test_seal_append_blob(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) resp = blob.seal_append_blob() @@ -1454,7 +1454,7 @@ def test_seal_append_blob_with_append_condition(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) with pytest.raises(HttpResponseError): @@ -1469,7 +1469,7 @@ def test_copy_sealed_blob_will_get_a_sealed_blob(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) @@ -1489,7 +1489,7 @@ def test_copy_unsealed_blob_will_get_a_sealed_blob(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) @@ -1513,7 +1513,7 @@ def test_copy_sealed_blob_with_seal_blob_will_get_a_sealed_blob(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) @@ -1534,7 +1534,7 @@ def test_create_append_blob_with_immutability_policy(self, **kwargs): storage_resource_group_name = kwargs.pop("storage_resource_group_name") variables = kwargs.pop("variables", {}) - bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key.secret, max_block_size=4 * 1024) self._setup(bsc) container_name = self.get_resource_name('vlwcontainer') @@ -1578,7 +1578,7 @@ def test_upload_progress_chunked(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) self._setup(bsc) blob_name = self._get_blob_reference() @@ -1590,7 +1590,7 @@ def test_upload_progress_chunked(self, **kwargs): blob_client = BlobClient( self.account_url(storage_account_name, 'blob'), self.container_name, blob_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, max_block_size=1024) blob_client.upload_blob( @@ -1611,7 +1611,7 @@ def test_append_block_from_file_to_blob_with_oauth(self, **kwargs): # Arrange account_url = self.account_url(storage_account_name, "blob") - bsc = BlobServiceClient(account_url, storage_account_key) + bsc = BlobServiceClient(account_url, storage_account_key.secret) self._setup(bsc) bearer_token_string = self._get_bearer_token_string() @@ -1631,7 +1631,7 @@ def test_append_block_from_file_to_blob_with_oauth(self, **kwargs): account_url=account_url, container_name=self.source_container_name, blob_name=self.get_resource_name(TEST_BLOB_PREFIX + "1"), - credential=storage_account_key + credential=storage_account_key.secret ) destination_blob_client.create_append_blob() 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 892b88b3c488..8ce1add3a487 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 @@ -83,7 +83,7 @@ async def test_append_block_from_url_with_oauth(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) await self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) source_blob_client = await self._create_source_blob(source_blob_data, bsc) @@ -106,7 +106,7 @@ async def test_create_blob(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob_name = self._get_blob_reference() @@ -126,7 +126,7 @@ async def test_get_blob_properties_using_vid(self, **kwargs): versioned_storage_account_name = kwargs.pop("versioned_storage_account_name") versioned_storage_account_key = kwargs.pop("versioned_storage_account_key") - bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob_name = self._get_blob_reference() @@ -148,7 +148,7 @@ async def test_create_blob_with_lease_id(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -168,7 +168,7 @@ async def test_create_blob_with_metadata(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) metadata = {'hello': 'world', 'number': '42'} blob_name = self._get_blob_reference() @@ -187,7 +187,7 @@ async def test_append_block(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -208,7 +208,7 @@ async def test_append_block_high_throughput(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key, max_block_size=100 * 1024 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret, max_block_size=100 * 1024 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) data = self.get_random_bytes(5 * 1024) @@ -226,7 +226,7 @@ async def test_append_block_unicode(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -245,7 +245,7 @@ async def test_append_block_with_if_tags(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) tags = {"tag1 name": "my tag", "tag2": "secondtag", "tag3": "thirdtag"} blob = await self._create_blob(bsc, tags=tags) @@ -264,7 +264,7 @@ async def test_append_block_with_md5(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -284,7 +284,7 @@ async def test_append_block_from_url(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) source_blob_client = await self._create_source_blob(source_blob_data, bsc) @@ -346,7 +346,7 @@ async def test_append_block_from_url_and_validate_content_md5(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) source_blob_client = await self._create_source_blob(source_blob_data, bsc) @@ -391,7 +391,7 @@ async def test_append_block_from_url_with_source_if_modified(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) source_blob_client = await self._create_source_blob(source_blob_data, bsc) @@ -441,7 +441,7 @@ async def test_append_block_from_url_with_source_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) source_blob_client = await self._create_source_blob(source_blob_data, bsc) @@ -492,7 +492,7 @@ async def test_append_block_from_url_with_source_if_match(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) source_blob_client = await self._create_source_blob(source_blob_data, bsc) @@ -542,7 +542,7 @@ async def test_append_block_from_url_with_source_if_none_match(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) source_blob_client = await self._create_source_blob(source_blob_data, bsc) @@ -592,7 +592,7 @@ async def test_append_block_from_url_with_if_match(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) source_blob_client = await self._create_source_blob(source_blob_data, bsc) @@ -645,7 +645,7 @@ async def test_append_block_from_url_with_if_none_match(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) source_blob_client = await self._create_source_blob(source_blob_data, bsc) @@ -694,7 +694,7 @@ async def test_append_block_from_url_with_maxsize_condition(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) source_blob_client = await self._create_source_blob(source_blob_data, bsc) @@ -742,7 +742,7 @@ async def test_append_block_from_url_with_appendpos_condition(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) source_blob_client = await self._create_source_blob(source_blob_data, bsc) @@ -790,7 +790,7 @@ async def test_append_block_from_url_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) source_blob_client = await self._create_source_blob(source_blob_data, bsc) @@ -840,7 +840,7 @@ async def test_append_block_from_url_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) source_blob_data = self.get_random_bytes(LARGE_BLOB_SIZE) source_blob_client = await self._create_source_blob(source_blob_data, bsc) @@ -889,7 +889,7 @@ async def test_create_append_blob_with_no_overwrite(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob_name = self._get_blob_reference() blob = bsc.get_blob_client( @@ -928,7 +928,7 @@ async def test_create_append_blob_with_overwrite(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob_name = self._get_blob_reference() blob = bsc.get_blob_client( @@ -965,7 +965,7 @@ async def test_append_blob_from_bytes(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -985,7 +985,7 @@ async def test_append_blob_from_0_bytes(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -1005,7 +1005,7 @@ async def test_append_blob_from_bytes_with_progress(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) data = b'abcdefghijklmnopqrstuvwxyz' @@ -1030,7 +1030,7 @@ async def test_append_blob_from_bytes_with_index(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -1047,7 +1047,7 @@ async def test_append_blob_from_bytes_with_index_and_count(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -1064,7 +1064,7 @@ async def test_append_blob_from_bytes_chunked_upload(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1084,7 +1084,7 @@ async def test_app_blob_from_bytes_progress_chnked_upload(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1115,7 +1115,7 @@ async def test_appblob_frm_bytes_chnked_upload_w_idx_n_count(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1134,7 +1134,7 @@ async def test_append_blob_from_path_chunked_upload(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1157,7 +1157,7 @@ async def test_append_blob_from_path_with_progress_chunked_upload(self, **kwargs storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1193,7 +1193,7 @@ async def test_append_blob_from_stream_chunked_upload(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1216,7 +1216,7 @@ async def test_append_blob_from_stream_non_seekable_chunked_upload_known_size(se storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1238,7 +1238,7 @@ async def test_append_blob_from_stream_non_seekable_chunked_upload_unknown_size( storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1259,7 +1259,7 @@ async def test_append_blob_from_stream_with_multiple_appends(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1284,7 +1284,7 @@ async def test_append_blob_from_stream_chunked_upload_with_count(self, **kwargs) storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1306,7 +1306,7 @@ async def test_append_blob_from_stream_chunked_upload_with_count_parallel(self, storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1330,7 +1330,7 @@ async def test_append_blob_from_text(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) text = u'hello 啊齄丂狛狜 world' @@ -1351,7 +1351,7 @@ async def test_append_blob_from_text_with_encoding(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) text = u'hello 啊齄丂狛狜 world' @@ -1369,7 +1369,7 @@ async def test_append_blob_from_text_with_encoding_and_progress(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) text = u'hello 啊齄丂狛狜 world' @@ -1394,7 +1394,7 @@ async def test_append_blob_from_text_chunked_upload(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) data = self.get_random_text_data(LARGE_BLOB_SIZE) @@ -1412,7 +1412,7 @@ async def test_append_blob_with_md5(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) data = b'hello world' @@ -1426,7 +1426,7 @@ async def test_seal_append_blob(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) resp = await blob.seal_append_blob() @@ -1446,7 +1446,7 @@ async def test_seal_append_blob_with_append_condition(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) with pytest.raises(HttpResponseError): @@ -1461,7 +1461,7 @@ async def test_copy_sealed_blob_will_get_a_sealed_blob(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -1481,7 +1481,7 @@ async def test_copy_unsealed_blob_will_get_a_sealed_blob(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -1505,7 +1505,7 @@ async def test_copy_sealed_blob_with_seal_blob_will_get_a_sealed_blob(self, **kw storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -1527,7 +1527,7 @@ async def test_create_append_blob_with_immutability_policy(self, **kwargs): storage_resource_group_name = kwargs.pop("storage_resource_group_name") variables = kwargs.pop("variables", {}) - bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key, max_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key.secret, max_block_size=4 * 1024) await self._setup(bsc) container_name = self.get_resource_name('vlwcontainerasync') @@ -1571,7 +1571,7 @@ async def test_upload_progress_chunked(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) await self._setup(bsc) blob_name = self._get_blob_reference() @@ -1583,7 +1583,7 @@ async def test_upload_progress_chunked(self, **kwargs): blob_client = BlobClient( self.account_url(storage_account_name, 'blob'), self.container_name, blob_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, max_block_size=1024) await blob_client.upload_blob( @@ -1604,7 +1604,7 @@ async def test_append_block_from_file_to_blob_with_oauth(self, **kwargs): # Arrange account_url = self.account_url(storage_account_name, "blob") - bsc = BlobServiceClient(account_url, storage_account_key) + bsc = BlobServiceClient(account_url, storage_account_key.secret) await self._setup(bsc) bearer_token_string = await self._get_bearer_token_string() @@ -1624,7 +1624,7 @@ async def test_append_block_from_file_to_blob_with_oauth(self, **kwargs): account_url=account_url, container_name=self.source_container_name, blob_name=self.get_resource_name(TEST_BLOB_PREFIX + "1"), - credential=storage_account_key + credential=storage_account_key.secret ) await destination_blob_client.create_append_blob() 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 61c60542de07..3a17c3ec07b6 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 @@ -72,7 +72,7 @@ def test_get_blob_service_client_from_container(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") bsc1 = BlobServiceClient( - self.account_url(storage_account_name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + self.account_url(storage_account_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container_client1 = self._create_container(self.container_name, bsc1) @@ -103,7 +103,7 @@ def test_get_container_client_from_blob(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") bsc = BlobServiceClient( - self.account_url(storage_account_name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + self.account_url(storage_account_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container_client1 = self._create_container(self.container_name, bsc) @@ -141,7 +141,7 @@ def test_set_container_metadata_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container = self._create_container(self.container_name, bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() - timedelta(minutes=15)) @@ -163,7 +163,7 @@ def test_set_container_metadata_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container = self._create_container(self.container_name, bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() + timedelta(minutes=15)) @@ -185,7 +185,7 @@ def test_set_container_acl_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container = self._create_container(self.container_name, bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() - timedelta(minutes=15)) @@ -212,7 +212,7 @@ def test_set_container_acl_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container = self._create_container(self.container_name, bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() + timedelta(minutes=15)) @@ -239,7 +239,7 @@ def test_set_container_acl_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container = self._create_container(self.container_name, bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() + timedelta(minutes=15)) @@ -266,7 +266,7 @@ def test_set_container_acl_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container = self._create_container(self.container_name, bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() - timedelta(minutes=15)) @@ -293,7 +293,7 @@ def test_lease_container_acquire_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container = self._create_container(self.container_name, bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() - timedelta(minutes=15)) @@ -312,7 +312,7 @@ def test_lease_container_acquire_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container = self._create_container(self.container_name, bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() + timedelta(minutes=15)) @@ -334,7 +334,7 @@ def test_lease_container_acquire_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container = self._create_container(self.container_name, bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() + timedelta(minutes=15)) @@ -353,7 +353,7 @@ def test_lease_container_acquire_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container = self._create_container(self.container_name, bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() - timedelta(minutes=15)) @@ -375,7 +375,7 @@ def test_delete_container_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container = self._create_container(self.container_name, bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() - timedelta(minutes=15)) @@ -397,7 +397,7 @@ def test_delete_container_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container = self._create_container(self.container_name, bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() + timedelta(minutes=15)) @@ -418,7 +418,7 @@ def test_delete_container_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container = self._create_container(self.container_name, bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() + timedelta(minutes=15)) @@ -439,7 +439,7 @@ def test_delete_container_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container = self._create_container(self.container_name, bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() - timedelta(minutes=15)) @@ -466,7 +466,7 @@ def _validate_headers(request): assert header == 'test_value' bsc = BlobServiceClient( - self.account_url(storage_account_name, "blob"), storage_account_key, max_single_put_size=100, max_block_size=50) + self.account_url(storage_account_name, "blob"), storage_account_key.secret, max_single_put_size=100, max_block_size=50) self._setup() data = self.get_random_bytes(2 * 100) self._create_container(self.container_name, bsc) @@ -485,7 +485,7 @@ def test_put_blob_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() data = b'hello world' container, blob = self._create_container_and_block_blob( @@ -507,7 +507,7 @@ def test_put_blob_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() data = b'hello world' container, blob = self._create_container_and_block_blob( @@ -530,7 +530,7 @@ def test_put_blob_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() data = b'hello world' container, blob = self._create_container_and_block_blob( @@ -552,7 +552,7 @@ def test_put_blob_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() data = b'hello world' container, blob = self._create_container_and_block_blob( @@ -574,7 +574,7 @@ def test_put_blob_with_if_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() data = b'hello world' container, blob = self._create_container_and_block_blob( @@ -598,7 +598,7 @@ def test_put_blob_with_if_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() data = b'hello world' container, blob = self._create_container_and_block_blob( @@ -622,7 +622,7 @@ def test_put_blob_with_if_none_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() data = b'hello world' container, blob = self._create_container_and_block_blob( @@ -644,7 +644,7 @@ def test_put_blob_with_if_none_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() data = b'hello world' container, blob = self._create_container_and_block_blob( @@ -665,7 +665,7 @@ def test_get_blob_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -686,7 +686,7 @@ def test_get_blob_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -708,7 +708,7 @@ def test_get_blob_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -729,7 +729,7 @@ def test_get_blob_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -750,7 +750,7 @@ def test_get_blob_with_if_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -768,7 +768,7 @@ def test_get_blob_with_if_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -786,7 +786,7 @@ def test_get_blob_with_if_none_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -803,7 +803,7 @@ def test_get_blob_with_if_none_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -823,7 +823,7 @@ def test_set_blob_properties_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, 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_set_blob_properties_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -874,7 +874,7 @@ def test_set_blob_properties_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -900,7 +900,7 @@ def test_set_blob_properties_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -925,7 +925,7 @@ def test_get_properties_last_access_time(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key, + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob(self.container_name, 'blob1', b'hello world', bsc) @@ -950,7 +950,7 @@ def test_set_blob_properties_with_if_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -974,7 +974,7 @@ def test_set_blob_properties_with_if_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -996,7 +996,7 @@ def test_set_blob_properties_with_if_none_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1019,7 +1019,7 @@ def test_set_blob_properties_with_if_none_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1043,7 +1043,7 @@ def test_get_blob_properties_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1066,7 +1066,7 @@ def test_if_blob_exists_vid(self, **kwargs): versioned_storage_account_name = kwargs.pop("versioned_storage_account_name") versioned_storage_account_key = kwargs.pop("versioned_storage_account_key") - bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1102,7 +1102,7 @@ def test_if_blob_with_cpk_exists(self, **kwargs): container_name = self.get_resource_name("testcontainer1") cc = ContainerClient( - self.account_url(storage_account_name, "blob"), credential=storage_account_key, container_name=container_name, + self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, container_name=container_name, connection_data_block_size=4 * 1024) cc.create_container() self._setup() @@ -1119,7 +1119,7 @@ def test_get_blob_properties_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1141,7 +1141,7 @@ def test_get_blob_properties_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1165,7 +1165,7 @@ def test_get_blob_properties_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1186,7 +1186,7 @@ def test_get_blob_properties_with_if_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, 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_get_blob_properties_with_if_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1227,7 +1227,7 @@ def test_get_blob_properties_with_if_none_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1248,7 +1248,7 @@ def test_get_blob_properties_with_if_none_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1269,7 +1269,7 @@ def test_get_blob_metadata_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1291,7 +1291,7 @@ def test_get_blob_metadata_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1314,7 +1314,7 @@ def test_get_blob_metadata_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1336,7 +1336,7 @@ def test_get_blob_metadata_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1358,7 +1358,7 @@ def test_get_blob_metadata_with_if_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1377,7 +1377,7 @@ def test_get_blob_metadata_with_if_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1396,7 +1396,7 @@ def test_get_blob_metadata_with_if_none_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1414,7 +1414,7 @@ def test_get_blob_metadata_with_if_none_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1435,7 +1435,7 @@ def test_set_blob_metadata_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1459,7 +1459,7 @@ def test_set_blob_metadata_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1483,7 +1483,7 @@ def test_set_blob_metadata_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1507,7 +1507,7 @@ def test_set_blob_metadata_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1530,7 +1530,7 @@ def test_set_blob_metadata_with_if_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1551,7 +1551,7 @@ def test_set_blob_metadata_with_if_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1571,7 +1571,7 @@ def test_set_blob_metadata_with_if_none_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1591,7 +1591,7 @@ def test_set_blob_metadata_with_if_none_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1613,7 +1613,7 @@ def test_delete_blob_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() - timedelta(minutes=15)) self._create_container_and_block_blob( @@ -1635,7 +1635,7 @@ def test_delete_blob_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() + timedelta(minutes=15)) self._create_container_and_block_blob( @@ -1658,7 +1658,7 @@ def test_delete_blob_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() + timedelta(minutes=15)) self._create_container_and_block_blob( @@ -1680,7 +1680,7 @@ def test_delete_blob_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() - timedelta(minutes=15)) self._create_container_and_block_blob( @@ -1702,7 +1702,7 @@ def test_delete_blob_with_if_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1722,7 +1722,7 @@ def test_delete_blob_with_if_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1741,7 +1741,7 @@ def test_delete_blob_with_if_none_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1759,7 +1759,7 @@ def test_delete_blob_with_if_none_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1780,7 +1780,7 @@ def test_snapshot_blob_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1803,7 +1803,7 @@ def test_snapshot_blob_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1826,7 +1826,7 @@ def test_snapshot_blob_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1849,7 +1849,7 @@ def test_snapshot_blob_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1871,7 +1871,7 @@ def test_snapshot_blob_with_if_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1891,7 +1891,7 @@ def test_snapshot_blob_with_if_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1910,7 +1910,7 @@ def test_snapshot_blob_with_if_none_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1929,7 +1929,7 @@ def test_snapshot_blob_with_if_none_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1950,7 +1950,7 @@ def test_lease_blob_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1978,7 +1978,7 @@ def test_lease_blob_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -2002,7 +2002,7 @@ def test_lease_blob_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -2030,7 +2030,7 @@ def test_lease_blob_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -2053,7 +2053,7 @@ def test_lease_blob_with_if_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -2080,7 +2080,7 @@ def test_lease_blob_with_if_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -2100,7 +2100,7 @@ def test_lease_blob_with_if_none_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -2125,7 +2125,7 @@ def test_lease_blob_with_if_none_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -2147,7 +2147,7 @@ def test_put_block_list_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -2172,7 +2172,7 @@ def test_put_block_list_returns_vid(self, **kwargs): versioned_storage_account_name = kwargs.pop("versioned_storage_account_name") versioned_storage_account_key = kwargs.pop("versioned_storage_account_key") - bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -2195,7 +2195,7 @@ def test_put_block_list_with_metadata(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -2221,7 +2221,7 @@ def test_put_block_list_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -2248,7 +2248,7 @@ def test_put_block_list_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -2274,7 +2274,7 @@ def test_put_block_list_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -2300,7 +2300,7 @@ def test_put_block_list_with_if_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -2323,7 +2323,7 @@ def test_put_block_list_with_if_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -2346,7 +2346,7 @@ def test_put_block_list_with_if_none_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -2368,7 +2368,7 @@ def test_put_block_list_with_if_none_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -2392,7 +2392,7 @@ def test_update_page_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -2412,7 +2412,7 @@ def test_update_page_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -2436,7 +2436,7 @@ def test_update_page_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -2456,7 +2456,7 @@ def test_update_page_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -2479,7 +2479,7 @@ def test_update_page_with_if_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -2498,7 +2498,7 @@ def test_update_page_with_if_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -2518,7 +2518,7 @@ def test_update_page_with_if_none_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -2536,7 +2536,7 @@ def test_update_page_with_if_none_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -2558,7 +2558,7 @@ def test_get_page_ranges_iter_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -2584,7 +2584,7 @@ def test_get_page_ranges_iter_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -2609,7 +2609,7 @@ def test_get_page_ranges_iter_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -2635,7 +2635,7 @@ def test_get_page_ranges_iter_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -2659,7 +2659,7 @@ def test_get_page_ranges_iter_with_if_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -2682,7 +2682,7 @@ def test_get_page_ranges_iter_with_if_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -2703,7 +2703,7 @@ def test_get_page_ranges_iter_with_if_none_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -2725,7 +2725,7 @@ def test_get_page_ranges_iter_with_if_none_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -2749,7 +2749,7 @@ def test_append_block_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_append_blob(self.container_name, 'blob1', bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() - timedelta(minutes=15)) @@ -2771,7 +2771,7 @@ def test_append_block_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_append_blob(self.container_name, 'blob1', bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() + timedelta(minutes=15)) @@ -2792,7 +2792,7 @@ def test_append_block_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_append_blob(self.container_name, 'blob1', bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() + timedelta(minutes=15)) @@ -2814,7 +2814,7 @@ def test_append_block_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_append_blob(self.container_name, 'blob1', bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() - timedelta(minutes=15)) @@ -2834,7 +2834,7 @@ def test_append_block_with_if_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_append_blob(self.container_name, 'blob1', bsc) @@ -2854,7 +2854,7 @@ def test_append_block_with_if_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_append_blob(self.container_name, 'blob1', bsc) @@ -2869,7 +2869,7 @@ def test_append_block_with_if_none_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_append_blob(self.container_name, 'blob1', bsc) @@ -2888,7 +2888,7 @@ def test_append_block_with_if_none_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = self._create_container_and_append_blob(self.container_name, 'blob1', bsc) @@ -2908,7 +2908,7 @@ def test_append_blob_from_bytes_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, 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) @@ -2931,7 +2931,7 @@ def test_append_blob_from_bytes_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, 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) @@ -2953,7 +2953,7 @@ def test_append_blob_from_bytes_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, 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) @@ -2976,7 +2976,7 @@ def test_append_blob_from_bytes_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, 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) @@ -2997,7 +2997,7 @@ def test_append_blob_from_bytes_with_if_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, 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) @@ -3017,7 +3017,7 @@ def test_append_blob_from_bytes_with_if_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, 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) @@ -3036,7 +3036,7 @@ def test_append_blob_from_bytes_with_if_none_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, 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) @@ -3056,7 +3056,7 @@ def test_append_blob_from_bytes_with_if_none_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, 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) @@ -3077,7 +3077,7 @@ def test_header_metadata_sort_in_upload_blob_fails(self, **kwargs): self._setup() data = b'hello world' - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) try: container_client = bsc.create_container(self.container_name) except: @@ -3108,7 +3108,7 @@ def test_header_metadata_sort_in_upload_blob(self, **kwargs): self._setup() data = b'hello world' - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) try: container_client = bsc.create_container(self.container_name) except: @@ -3132,7 +3132,7 @@ def test_header_metadata_sort_in_upload_blob_translation(self, **kwargs): self._setup() data = b'hello world' - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) try: container_client = bsc.create_container(self.container_name) except: 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 52a3a9e8b827..1904fc3941a5 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 @@ -73,7 +73,7 @@ async def test_get_blob_service_client_from_container(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") bsc1 = BlobServiceClient( - self.account_url(storage_account_name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + self.account_url(storage_account_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container_client1 = await self._create_container(self.container_name, bsc1) @@ -106,7 +106,7 @@ async def test_get_container_client_from_blob(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") bsc = BlobServiceClient( - self.account_url(storage_account_name, "blob"), storage_account_key, connection_data_block_size=4 * 1024) + self.account_url(storage_account_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container_client1 = await self._create_container(self.container_name, bsc) @@ -148,7 +148,7 @@ async def test_set_container_metadata_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container = await self._create_container(self.container_name, bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() - timedelta(minutes=15)) @@ -170,7 +170,7 @@ async def test_set_container_md_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container = await self._create_container(self.container_name, bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() + timedelta(minutes=15)) @@ -192,7 +192,7 @@ async def test_set_container_acl_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container = await self._create_container(self.container_name, bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() - timedelta(minutes=15)) @@ -219,7 +219,7 @@ async def test_set_container_acl_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container = await self._create_container(self.container_name, bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() + timedelta(minutes=15)) @@ -246,7 +246,7 @@ async def test_set_container_acl_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container = await self._create_container(self.container_name, bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() + timedelta(minutes=15)) @@ -274,7 +274,7 @@ async def test_set_container_acl_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container = await self._create_container(self.container_name, bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() - timedelta(minutes=15)) @@ -301,7 +301,7 @@ async def test_lease_container_acquire_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container = await self._create_container(self.container_name, bsc) test_lease_id = '00000000-1111-2222-3333-444444444444' @@ -320,7 +320,7 @@ async def test_lease_cont_acquire_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container = await self._create_container(self.container_name, bsc) test_lease_id = '00000000-1111-2222-3333-444444444444' @@ -342,7 +342,7 @@ async def test_lease_container_acquire_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container = await self._create_container(self.container_name, bsc) test_lease_id = '00000000-1111-2222-3333-444444444444' @@ -361,7 +361,7 @@ async def test_lease_container_acquire_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container = await self._create_container(self.container_name, bsc) test_lease_id = '00000000-1111-2222-3333-444444444444' @@ -383,7 +383,7 @@ async def test_delete_container_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container = await self._create_container(self.container_name, bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() - timedelta(minutes=15)) @@ -404,7 +404,7 @@ async def test_delete_container_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container = await self._create_container(self.container_name, bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() + timedelta(minutes=15)) @@ -424,7 +424,7 @@ async def test_delete_container_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container = await self._create_container(self.container_name, bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() + timedelta(minutes=15)) @@ -444,7 +444,7 @@ async def test_delete_container_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container = await self._create_container(self.container_name, bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() - timedelta(minutes=15)) @@ -470,7 +470,7 @@ def _validate_headers(request): assert header == 'test_value' bsc = BlobServiceClient( - self.account_url(storage_account_name, "blob"), storage_account_key, max_single_put_size=100, max_block_size=50) + self.account_url(storage_account_name, "blob"), storage_account_key.secret, max_single_put_size=100, max_block_size=50) self._setup() data = self.get_random_bytes(2 * 100) await self._create_container(self.container_name, bsc) @@ -489,7 +489,7 @@ async def test_put_blob_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() data = b'hello world' container, blob = await self._create_container_and_block_blob( @@ -511,7 +511,7 @@ async def test_put_blob_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() data = b'hello world' container, blob = await self._create_container_and_block_blob( @@ -534,7 +534,7 @@ async def test_put_blob_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() data = b'hello world' container, blob = await self._create_container_and_block_blob( @@ -556,7 +556,7 @@ async def test_put_blob_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() data = b'hello world' container, blob = await self._create_container_and_block_blob( @@ -578,7 +578,7 @@ async def test_put_blob_with_if_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() data = b'hello world' container, blob = await self._create_container_and_block_blob( @@ -597,7 +597,7 @@ async def test_put_blob_with_if_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() data = b'hello world' container, blob = await self._create_container_and_block_blob( @@ -618,7 +618,7 @@ async def test_put_blob_with_if_none_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() data = b'hello world' container, blob = await self._create_container_and_block_blob( @@ -636,7 +636,7 @@ async def test_put_blob_with_if_none_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() data = b'hello world' container, blob = await self._create_container_and_block_blob( @@ -657,7 +657,7 @@ async def test_get_blob_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -679,7 +679,7 @@ async def test_get_blob_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -701,7 +701,7 @@ async def test_get_blob_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -723,7 +723,7 @@ async def test_get_blob_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -744,7 +744,7 @@ async def test_get_blob_with_if_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -763,7 +763,7 @@ async def test_get_blob_with_if_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -781,7 +781,7 @@ async def test_get_blob_with_if_none_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -799,7 +799,7 @@ async def test_get_blob_with_if_none_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -819,7 +819,7 @@ async def test_set_blob_props_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -845,7 +845,7 @@ async def test_set_blob_props_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -870,7 +870,7 @@ async def test_set_blob_props_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -896,7 +896,7 @@ async def test_set_blob_props_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -920,7 +920,7 @@ async def test_set_blob_props_with_if_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -944,7 +944,7 @@ async def test_set_blob_props_with_if_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -966,7 +966,7 @@ async def test_set_blob_props_with_if_none_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -989,7 +989,7 @@ async def test_set_blob_props_with_if_none_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1013,7 +1013,7 @@ async def test_if_blob_exists_vid(self, **kwargs): versioned_storage_account_name = kwargs.pop("versioned_storage_account_name") versioned_storage_account_key = kwargs.pop("versioned_storage_account_key") - bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1051,7 +1051,7 @@ async def test_if_blob_with_cpk_exists(self, **kwargs): container_name = self.get_resource_name("testcontainer1") cc = ContainerClient( - self.account_url(storage_account_name, "blob"), credential=storage_account_key, container_name=container_name, + self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, container_name=container_name, connection_data_block_size=4 * 1024) await cc.create_container() self._setup() @@ -1068,7 +1068,7 @@ async def test_get_blob_properties_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1092,7 +1092,7 @@ async def test_get_blob_properties_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1114,7 +1114,7 @@ async def test_get_blob_properties_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1138,7 +1138,7 @@ async def test_get_blob_properties_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1159,7 +1159,7 @@ async def test_get_blob_properties_with_if_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1181,7 +1181,7 @@ async def test_get_blob_properties_with_if_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1200,7 +1200,7 @@ async def test_get_blob_properties_with_if_none_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1221,7 +1221,7 @@ async def test_get_blob_properties_with_if_none_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1242,7 +1242,7 @@ async def test_get_blob_metadata_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1264,7 +1264,7 @@ async def test_get_blob_metadata_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1287,7 +1287,7 @@ async def test_get_blob_metadata_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1309,7 +1309,7 @@ async def test_get_blob_metadata_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1331,7 +1331,7 @@ async def test_get_blob_metadata_with_if_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1350,7 +1350,7 @@ async def test_get_blob_metadata_with_if_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1369,7 +1369,7 @@ async def test_get_blob_metadata_with_if_none_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1387,7 +1387,7 @@ async def test_get_blob_metadata_with_if_none_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1408,7 +1408,7 @@ async def test_set_blob_metadata_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1432,7 +1432,7 @@ async def test_set_blob_metadata_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1456,7 +1456,7 @@ async def test_set_blob_metadata_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1480,7 +1480,7 @@ async def test_set_blob_metadata_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1503,7 +1503,7 @@ async def test_set_blob_metadata_with_if_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1524,7 +1524,7 @@ async def test_set_blob_metadata_with_if_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1544,7 +1544,7 @@ async def test_set_blob_metadata_with_if_none_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1564,7 +1564,7 @@ async def test_set_blob_metadata_with_if_none_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1586,7 +1586,7 @@ async def test_delete_blob_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() - timedelta(minutes=15)) await self._create_container_and_block_blob( @@ -1608,7 +1608,7 @@ async def test_delete_blob_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() + timedelta(minutes=15)) await self._create_container_and_block_blob( @@ -1631,7 +1631,7 @@ async def test_delete_blob_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() + timedelta(minutes=15)) await self._create_container_and_block_blob( @@ -1653,7 +1653,7 @@ async def test_delete_blob_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() - timedelta(minutes=15)) await self._create_container_and_block_blob( @@ -1675,7 +1675,7 @@ async def test_delete_blob_with_if_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1695,7 +1695,7 @@ async def test_delete_blob_with_if_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1714,7 +1714,7 @@ async def test_delete_blob_with_if_none_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1732,7 +1732,7 @@ async def test_delete_blob_with_if_none_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1753,7 +1753,7 @@ async def test_snapshot_blob_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1776,7 +1776,7 @@ async def test_snapshot_blob_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1799,7 +1799,7 @@ async def test_snapshot_blob_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1822,7 +1822,7 @@ async def test_snapshot_blob_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1844,7 +1844,7 @@ async def test_snapshot_blob_with_if_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1864,7 +1864,7 @@ async def test_snapshot_blob_with_if_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1883,7 +1883,7 @@ async def test_snapshot_blob_with_if_none_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1902,7 +1902,7 @@ async def test_snapshot_blob_with_if_none_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1923,7 +1923,7 @@ async def test_lease_blob_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1951,7 +1951,7 @@ async def test_lease_blob_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -1975,7 +1975,7 @@ async def test_lease_blob_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -2003,7 +2003,7 @@ async def test_lease_blob_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -2026,7 +2026,7 @@ async def test_lease_blob_with_if_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -2053,7 +2053,7 @@ async def test_lease_blob_with_if_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -2076,7 +2076,7 @@ async def test_lease_blob_with_if_none_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -2101,7 +2101,7 @@ async def test_lease_blob_with_if_none_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_block_blob( self.container_name, 'blob1', b'hello world', bsc) @@ -2126,7 +2126,7 @@ async def test_put_block_list_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -2153,7 +2153,7 @@ async def test_put_block_list_returns_vid(self, **kwargs): versioned_storage_account_name = kwargs.pop("versioned_storage_account_name") versioned_storage_account_key = kwargs.pop("versioned_storage_account_key") - bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key, connection_data_block_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -2179,7 +2179,7 @@ async def test_put_block_list_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -2207,7 +2207,7 @@ async def test_put_block_list_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -2235,7 +2235,7 @@ async def test_put_block_list_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -2262,7 +2262,7 @@ async def test_put_block_list_with_if_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -2287,7 +2287,7 @@ async def test_put_block_list_with_if_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -2311,7 +2311,7 @@ async def test_put_block_list_with_if_none_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -2335,7 +2335,7 @@ async def test_put_block_list_with_if_none_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_block_blob( self.container_name, 'blob1', b'', bsc) @@ -2360,7 +2360,7 @@ async def test_update_page_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -2380,7 +2380,7 @@ async def test_update_page_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -2404,7 +2404,7 @@ async def test_update_page_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -2424,7 +2424,7 @@ async def test_update_page_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -2447,7 +2447,7 @@ async def test_update_page_with_if_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -2466,7 +2466,7 @@ async def test_update_page_with_if_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -2486,7 +2486,7 @@ async def test_update_page_with_if_none_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -2504,7 +2504,7 @@ async def test_update_page_with_if_none_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() await self._create_container_and_page_blob( self.container_name, 'blob1', 1024, bsc) @@ -2526,7 +2526,7 @@ async def test_get_page_ranges_iter_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -2551,7 +2551,7 @@ async def test_get_page_ranges_iter_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -2575,7 +2575,7 @@ async def test_get_page_ranges_iter_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -2600,7 +2600,7 @@ async def test_get_page_ranges_iter_with_if_unmod_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -2623,7 +2623,7 @@ async def test_get_page_ranges_iter_with_if_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -2645,7 +2645,7 @@ async def test_get_page_ranges_iter_with_if_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -2665,7 +2665,7 @@ async def test_get_page_ranges_iter_with_if_none_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -2686,7 +2686,7 @@ async def test_get_page_ranges_iter_if_none_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_page_blob( self.container_name, 'blob1', 2048, bsc) @@ -2709,7 +2709,7 @@ async def test_append_block_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_append_blob(self.container_name, 'blob1', bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() - timedelta(minutes=15)) @@ -2732,7 +2732,7 @@ async def test_append_block_with_if_modified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_append_blob(self.container_name, 'blob1', bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() + timedelta(minutes=15)) @@ -2753,7 +2753,7 @@ async def test_append_block_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_append_blob(self.container_name, 'blob1', bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() + timedelta(minutes=15)) @@ -2776,7 +2776,7 @@ async def test_append_block_with_if_unmodified_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_append_blob(self.container_name, 'blob1', bsc) test_datetime = self.get_datetime_variable(variables, 'if_modified', datetime.utcnow() - timedelta(minutes=15)) @@ -2796,7 +2796,7 @@ async def test_append_block_with_if_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_append_blob(self.container_name, 'blob1', bsc) @@ -2817,7 +2817,7 @@ async def test_append_block_with_if_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_append_blob(self.container_name, 'blob1', bsc) @@ -2832,7 +2832,7 @@ async def test_append_block_with_if_none_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_append_blob(self.container_name, 'blob1', bsc) @@ -2852,7 +2852,7 @@ async def test_append_block_with_if_none_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() container, blob = await self._create_container_and_append_blob(self.container_name, 'blob1', bsc) @@ -2872,7 +2872,7 @@ async def test_append_blob_from_bytes_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() blob_name = self.get_resource_name("blob") container, blob = await self._create_container_and_append_blob(self.container_name, blob_name, bsc) @@ -2896,7 +2896,7 @@ async def test_apnd_blob_from_bytes_with_if_mod_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() blob_name = self.get_resource_name("blob") container, blob = await self._create_container_and_append_blob(self.container_name, blob_name, bsc) @@ -2918,7 +2918,7 @@ async def test_append_blob_from_bytes_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() blob_name = self.get_resource_name("blob") container, blob = await self._create_container_and_append_blob(self.container_name, blob_name, bsc) @@ -2942,7 +2942,7 @@ async def test_append_blob_from_bytes_with_if_unmod_fail(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - 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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() blob_name = self.get_resource_name("blob") container, blob = await self._create_container_and_append_blob(self.container_name, blob_name, bsc) @@ -2963,7 +2963,7 @@ async def test_append_blob_from_bytes_with_if_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() blob_name = self.get_resource_name("blob") container, blob = await self._create_container_and_append_blob(self.container_name, blob_name, bsc) @@ -2984,7 +2984,7 @@ async def test_append_blob_from_bytes_with_if_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() blob_name = self.get_resource_name("blob") container, blob = await self._create_container_and_append_blob(self.container_name, blob_name, bsc) @@ -3003,7 +3003,7 @@ async def test_append_blob_from_bytes_with_if_none_match(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() blob_name = self.get_resource_name("blob") container, blob = await self._create_container_and_append_blob(self.container_name, blob_name, bsc) @@ -3024,7 +3024,7 @@ async def test_apnd_blob_from_bytes_if_none_match_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret, connection_data_block_size=4 * 1024) self._setup() blob_name = self.get_resource_name("blob") container, blob = await self._create_container_and_append_blob(self.container_name, blob_name, bsc) @@ -3045,7 +3045,7 @@ async def test_header_metadata_sort_in_upload_blob_fails(self, **kwargs): self._setup() data = b'hello world' - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) try: container_client = await bsc.create_container(self.container_name) except: @@ -3076,7 +3076,7 @@ async def test_header_metadata_sort_in_upload_blob(self, **kwargs): self._setup() data = b'hello world' - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) try: container_client = await bsc.create_container(self.container_name) except: @@ -3100,7 +3100,7 @@ async def test_header_metadata_sort_in_upload_blob(self, **kwargs): self._setup() data = b'hello world' - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) try: container_client = await bsc.create_container(self.container_name) except: @@ -3124,7 +3124,7 @@ async def test_header_metadata_sort_in_upload_blob_translation(self, **kwargs): self._setup() data = b'hello world' - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) try: container_client = await bsc.create_container(self.container_name) except: diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_api_version.py b/sdk/storage/azure-storage-blob/tests/test_blob_api_version.py index 3ae23a20f851..b20b9ed403ee 100644 --- a/sdk/storage/azure-storage-blob/tests/test_blob_api_version.py +++ b/sdk/storage/azure-storage-blob/tests/test_blob_api_version.py @@ -146,7 +146,7 @@ def test_old_api_get_page_ranges_succeeds(self, **kwargs): self._setup() bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, api_version=self.api_version_1) @@ -196,7 +196,7 @@ def test_invalid_service_version_message(self, **kwargs): with mock.patch("azure.storage.blob._serialize._SUPPORTED_API_VERSIONS", [INVALID_X_MS_VERSION]): bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, api_version=INVALID_X_MS_VERSION ) diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_api_version_async.py b/sdk/storage/azure-storage-blob/tests/test_blob_api_version_async.py index 61a8de6c1e0f..f5d062da4d25 100644 --- a/sdk/storage/azure-storage-blob/tests/test_blob_api_version_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_blob_api_version_async.py @@ -146,7 +146,7 @@ async def test_old_api_get_page_ranges_succeeds(self, **kwargs): self._setup() bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, connection_data_block_size=4 * 1024, max_page_size=4 * 1024, api_version=self.api_version_1) @@ -196,7 +196,7 @@ async def test_invalid_service_version_message(self, **kwargs): with mock.patch("azure.storage.blob._serialize._SUPPORTED_API_VERSIONS", [INVALID_X_MS_VERSION]): bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, api_version=INVALID_X_MS_VERSION ) 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 b4897f0f4e53..5ad959336629 100644 --- a/sdk/storage/azure-storage-blob/tests/test_blob_client.py +++ b/sdk/storage/azure-storage-blob/tests/test_blob_client.py @@ -41,7 +41,7 @@ def validate_standard_account_endpoints(self, service, url_type, name, storage_a assert service is not None assert service.account_name == name assert service.credential.account_name == name - assert service.credential.account_key == storage_account_key + assert service.credential.account_key == storage_account_key.secret assert '{}.{}.core.windows.net'.format(name, url_type) in service.url assert '{}-secondary.{}.core.windows.net'.format(name, url_type) in service.secondary_endpoint @@ -67,7 +67,7 @@ def test_create_service_with_key(self, **kwargs): 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_name, "blob"), credential=storage_account_key.secret, container_name='foo', blob_name='bar') # Assert self.validate_standard_account_endpoints(service, url, storage_account_name, storage_account_key) @@ -80,7 +80,7 @@ def test_create_blob_client_with_complete_blob_url(self, **kwargs): # Arrange blob_url = self.account_url(storage_account_name, "blob") + "/foourl/barurl" - service = BlobClient(blob_url, credential=storage_account_key, container_name='foo', blob_name='bar') + service = BlobClient(blob_url, credential=storage_account_key.secret, container_name='foo', blob_name='bar') # Assert assert service.scheme == 'https' @@ -96,7 +96,7 @@ def test_create_service_with_connection_string(self, **kwargs): for service_type in SERVICES.items(): # Act service = service_type[0].from_connection_string( - self.connection_string(storage_account_name, storage_account_key), container_name="test", blob_name="test") + self.connection_string(storage_account_name, storage_account_key.secret), container_name="test", blob_name="test") # Assert self.validate_standard_account_endpoints(service, service_type[1], storage_account_name, storage_account_key) @@ -209,13 +209,13 @@ def test_create_service_china(self, **kwargs): # Act url = self.account_url(storage_account_name, "blob").replace('core.windows.net', 'core.chinacloudapi.cn') service = service_type[0]( - url, credential=storage_account_key, container_name='foo', blob_name='bar') + url, credential=storage_account_key.secret, container_name='foo', blob_name='bar') # Assert assert service is not None assert service.account_name == storage_account_name assert service.credential.account_name == storage_account_name - assert service.credential.account_key == storage_account_key + assert service.credential.account_key == storage_account_key.secret assert service.primary_endpoint.startswith( 'https://{}.{}.core.chinacloudapi.cn'.format(storage_account_name, service_type[1])) assert service.secondary_endpoint.startswith( @@ -231,7 +231,7 @@ def test_create_service_protocol(self, **kwargs): # Act url = self.account_url(storage_account_name, "blob").replace('https', 'http') service = service_type[0]( - url, credential=storage_account_key, container_name='foo', blob_name='bar') + url, credential=storage_account_key.secret, container_name='foo', blob_name='bar') # Assert self.validate_standard_account_endpoints(service, service_type[1], storage_account_name, storage_account_key) @@ -266,7 +266,7 @@ def test_create_blob_service_custom_domain(self, **kwargs): # Act service = service_type( 'www.mydomain.com', - credential={'account_name': storage_account_name, 'account_key': storage_account_key}, + credential={'account_name': storage_account_name, 'account_key': storage_account_key.secret}, container_name='foo', blob_name='bar') @@ -274,7 +274,7 @@ def test_create_blob_service_custom_domain(self, **kwargs): assert service is not None assert service.account_name == storage_account_name assert service.credential.account_name == storage_account_name - assert service.credential.account_key == storage_account_key + assert service.credential.account_key == storage_account_key.secret assert service.primary_endpoint.startswith('https://www.mydomain.com/') assert service.secondary_endpoint.startswith('https://' + storage_account_name + '-secondary.blob.core.windows.net') @@ -288,10 +288,10 @@ def test_create_service_with_socket_timeout(self, **kwargs): 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_name, "blob"), credential=storage_account_key.secret, 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_name, "blob"), credential=storage_account_key.secret, container_name='foo', blob_name='bar', connection_timeout=22) # Assert @@ -307,7 +307,7 @@ def test_create_service_with_connection_string_key(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - conn_string = 'AccountName={};AccountKey={};'.format(storage_account_name, storage_account_key) + conn_string = 'AccountName={};AccountKey={};'.format(storage_account_name, storage_account_key.secret) for service_type in SERVICES.items(): # Act @@ -345,7 +345,7 @@ def test_create_service_with_connection_string_endpoint_protocol(self, **kwargs) # Arrange conn_string = 'AccountName={};AccountKey={};DefaultEndpointsProtocol=http;EndpointSuffix=core.chinacloudapi.cn;'.format( - storage_account_name, storage_account_key) + storage_account_name, storage_account_key.secret) for service_type in SERVICES.items(): # Act @@ -355,7 +355,7 @@ def test_create_service_with_connection_string_endpoint_protocol(self, **kwargs) assert service is not None assert service.account_name == storage_account_name assert service.credential.account_name == storage_account_name - assert service.credential.account_key == storage_account_key + assert service.credential.account_key == storage_account_key.secret assert service.primary_endpoint.startswith( 'http://{}.{}.core.chinacloudapi.cn/'.format(storage_account_name, service_type[1])) assert service.secondary_endpoint.startswith( @@ -387,7 +387,7 @@ def test_create_service_with_cstr_custom_domain(self, **kwargs): # Arrange for service_type in SERVICES.items(): conn_string = 'AccountName={};AccountKey={};BlobEndpoint=www.mydomain.com;'.format( - storage_account_name, storage_account_key) + storage_account_name, storage_account_key.secret) # Act service = service_type[0].from_connection_string(conn_string, container_name="foo", blob_name="bar") @@ -396,7 +396,7 @@ def test_create_service_with_cstr_custom_domain(self, **kwargs): assert service is not None assert service.account_name == storage_account_name assert service.credential.account_name == storage_account_name - assert service.credential.account_key == storage_account_key + assert service.credential.account_key == storage_account_key.secret assert service.primary_endpoint.startswith('https://www.mydomain.com/') assert service.secondary_endpoint.startswith('https://' + storage_account_name + '-secondary.blob.core.windows.net') @@ -408,7 +408,7 @@ def test_create_service_with_cstr_cust_dmn_trailing_slash(self, **kwargs): # Arrange for service_type in SERVICES.items(): conn_string = 'AccountName={};AccountKey={};BlobEndpoint=www.mydomain.com/;'.format( - storage_account_name, storage_account_key) + storage_account_name, storage_account_key.secret) # Act service = service_type[0].from_connection_string(conn_string, container_name="foo", blob_name="bar") @@ -417,7 +417,7 @@ def test_create_service_with_cstr_cust_dmn_trailing_slash(self, **kwargs): assert service is not None assert service.account_name == storage_account_name assert service.credential.account_name == storage_account_name - assert service.credential.account_key == storage_account_key + assert service.credential.account_key == storage_account_key.secret assert service.primary_endpoint.startswith('https://www.mydomain.com/') assert service.secondary_endpoint.startswith('https://' + storage_account_name + '-secondary.blob.core.windows.net') @@ -429,7 +429,7 @@ def test_create_service_with_cstr_custom_domain_sec_override(self, **kwargs): # Arrange for service_type in SERVICES.items(): conn_string = 'AccountName={};AccountKey={};BlobEndpoint=www.mydomain.com/;'.format( - storage_account_name, storage_account_key) + storage_account_name, storage_account_key.secret) # Act service = service_type[0].from_connection_string( @@ -439,7 +439,7 @@ def test_create_service_with_cstr_custom_domain_sec_override(self, **kwargs): assert service is not None assert service.account_name == storage_account_name assert service.credential.account_name == storage_account_name - assert service.credential.account_key == storage_account_key + assert service.credential.account_key == storage_account_key.secret assert service.primary_endpoint.startswith('https://www.mydomain.com/') assert service.secondary_endpoint.startswith('https://www-sec.mydomain.com/') @@ -451,7 +451,7 @@ def test_create_service_with_cstr_fails_if_sec_without_prim(self, **kwargs): for service_type in SERVICES.items(): # Arrange conn_string = 'AccountName={};AccountKey={};{}=www.mydomain.com;'.format( - storage_account_name, storage_account_key, + storage_account_name, storage_account_key.secret, _CONNECTION_ENDPOINTS_SECONDARY.get(service_type[1])) # Act @@ -469,7 +469,7 @@ def test_create_service_with_cstr_succeeds_if_sec_with_prim(self, **kwargs): # Arrange conn_string = 'AccountName={};AccountKey={};{}=www.mydomain.com;{}=www-sec.mydomain.com;'.format( storage_account_name, - storage_account_key, + storage_account_key.secret, _CONNECTION_ENDPOINTS.get(service_type[1]), _CONNECTION_ENDPOINTS_SECONDARY.get(service_type[1])) @@ -480,7 +480,7 @@ def test_create_service_with_cstr_succeeds_if_sec_with_prim(self, **kwargs): assert service is not None assert service.account_name == storage_account_name assert service.credential.account_name == storage_account_name - assert service.credential.account_key == storage_account_key + assert service.credential.account_key == storage_account_key.secret assert service.primary_endpoint.startswith('https://www.mydomain.com/') assert service.secondary_endpoint.startswith('https://www-sec.mydomain.com/') @@ -587,7 +587,7 @@ def test_request_callback_signed_header(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - service = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + service = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) name = self.get_resource_name('cont') # Act @@ -610,7 +610,7 @@ def test_response_callback(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - service = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + service = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) name = self.get_resource_name('cont') container = service.get_container_client(name) @@ -629,7 +629,7 @@ def test_user_agent_default(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - service = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + service = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) def callback(response): assert 'User-Agent' in response.http_request.headers @@ -645,7 +645,7 @@ def test_user_agent_custom(self, **kwargs): 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_name, "blob"), credential=storage_account_key.secret, user_agent=custom_app) def callback(response): assert 'User-Agent' in response.http_request.headers @@ -671,7 +671,7 @@ def test_user_agent_append(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - service = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + service = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) def callback(response): assert 'User-Agent' in response.http_request.headers @@ -705,7 +705,7 @@ def test_closing_pipeline_client(self, **kwargs): 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_name, "blob"), credential=storage_account_key.secret, container_name='foo', blob_name='bar') # Assert with service: @@ -721,7 +721,7 @@ def test_closing_pipeline_client_simple(self, **kwargs): 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_name, "blob"), credential=storage_account_key.secret, container_name='foo', blob_name='bar') service.close() @BlobPreparer() 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 5492f85c0cf7..3873f8d00b27 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 @@ -69,10 +69,10 @@ def test_create_service_with_key(self, **kwargs): 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_name, "blob"), credential=storage_account_key.secret, container_name='foo', blob_name='bar') # Assert - self.validate_standard_account_endpoints(service, url, storage_account_name, storage_account_key) + self.validate_standard_account_endpoints(service, url, storage_account_name, storage_account_key.secret) assert service.scheme == 'https' @BlobPreparer() @@ -84,10 +84,10 @@ def test_create_service_with_connection_string(self, **kwargs): for service_type in SERVICES.items(): # Act service = service_type[0].from_connection_string( - self.connection_string(storage_account_name, storage_account_key), container_name="test", blob_name="test") + self.connection_string(storage_account_name, storage_account_key.secret), container_name="test", blob_name="test") # Assert - self.validate_standard_account_endpoints(service, service_type[1], storage_account_name, storage_account_key) + self.validate_standard_account_endpoints(service, service_type[1], storage_account_name, storage_account_key.secret) assert service.scheme == 'https' @BlobPreparer() @@ -197,13 +197,13 @@ def test_create_service_china(self, **kwargs): # Act url = self.account_url(storage_account_name, "blob").replace('core.windows.net', 'core.chinacloudapi.cn') service = service_type[0]( - url, credential=storage_account_key, container_name='foo', blob_name='bar') + url, credential=storage_account_key.secret, container_name='foo', blob_name='bar') # Assert assert service is not None assert service.account_name == storage_account_name assert service.credential.account_name == storage_account_name - assert service.credential.account_key == storage_account_key + assert service.credential.account_key == storage_account_key.secret assert service.primary_endpoint.startswith( 'https://{}.{}.core.chinacloudapi.cn'.format(storage_account_name, service_type[1])) assert service.secondary_endpoint.startswith( @@ -219,10 +219,10 @@ def test_create_service_protocol(self, **kwargs): # Act url = self.account_url(storage_account_name, "blob").replace('https', 'http') service = service_type[0]( - url, credential=storage_account_key, container_name='foo', blob_name='bar') + url, credential=storage_account_key.secret, container_name='foo', blob_name='bar') # Assert - self.validate_standard_account_endpoints(service, service_type[1], storage_account_name, storage_account_key) + self.validate_standard_account_endpoints(service, service_type[1], storage_account_name, storage_account_key.secret) assert service.scheme == 'http' @BlobPreparer() @@ -254,7 +254,7 @@ def test_create_blob_service_custom_domain(self, **kwargs): # Act service = service_type( 'www.mydomain.com', - credential={'account_name': storage_account_name, 'account_key': storage_account_key}, + credential={'account_name': storage_account_name, 'account_key': storage_account_key.secret}, container_name='foo', blob_name='bar') @@ -262,7 +262,7 @@ def test_create_blob_service_custom_domain(self, **kwargs): assert service is not None assert service.account_name == storage_account_name assert service.credential.account_name == storage_account_name - assert service.credential.account_key == storage_account_key + assert service.credential.account_key == storage_account_key.secret assert service.primary_endpoint.startswith('https://www.mydomain.com/') assert service.secondary_endpoint.startswith('https://' + storage_account_name + '-secondary.blob.core.windows.net') @@ -276,14 +276,14 @@ def test_create_service_with_socket_timeout(self, **kwargs): 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_name, "blob"), credential=storage_account_key.secret, 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_name, "blob"), credential=storage_account_key.secret, container_name='foo', blob_name='bar', connection_timeout=22) # Assert - self.validate_standard_account_endpoints(service, service_type[1], storage_account_name, storage_account_key) + self.validate_standard_account_endpoints(service, service_type[1], storage_account_name, storage_account_key.secret) assert service._client._client._pipeline._transport.connection_config.timeout == 22 assert default_service._client._client._pipeline._transport.connection_config.timeout in [20, (20, 2000)] @@ -294,7 +294,7 @@ def test_create_service_with_connection_string_key(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - conn_string = 'AccountName={};AccountKey={};'.format(storage_account_name, storage_account_key) + conn_string = 'AccountName={};AccountKey={};'.format(storage_account_name, storage_account_key.secret) for service_type in SERVICES.items(): # Act @@ -302,7 +302,7 @@ def test_create_service_with_connection_string_key(self, **kwargs): conn_string, container_name='foo', blob_name='bar') # Assert - self.validate_standard_account_endpoints(service, service_type[1], storage_account_name, storage_account_key) + self.validate_standard_account_endpoints(service, service_type[1], storage_account_name, storage_account_key.secret) assert service.scheme == 'https' @BlobPreparer() @@ -332,7 +332,7 @@ def test_create_blob_client_with_complete_blob_url(self, **kwargs): # Arrange blob_url = self.account_url(storage_account_name, "blob") + "/foourl/barurl" - service = BlobClient(blob_url, credential=storage_account_key, container_name='foo', blob_name='bar') + service = BlobClient(blob_url, credential=storage_account_key.secret, container_name='foo', blob_name='bar') # Assert assert service.scheme == 'https' @@ -347,7 +347,7 @@ def test_creat_serv_w_connstr_endpoint_protocol(self, **kwargs): # Arrange conn_string = 'AccountName={};AccountKey={};DefaultEndpointsProtocol=http;EndpointSuffix=core.chinacloudapi.cn;'.format( - storage_account_name, storage_account_key) + storage_account_name, storage_account_key.secret) for service_type in SERVICES.items(): # Act @@ -357,7 +357,7 @@ def test_creat_serv_w_connstr_endpoint_protocol(self, **kwargs): assert service is not None assert service.account_name == storage_account_name assert service.credential.account_name == storage_account_name - assert service.credential.account_key == storage_account_key + assert service.credential.account_key == storage_account_key.secret assert service.primary_endpoint.startswith( 'http://{}.{}.core.chinacloudapi.cn/'.format(storage_account_name, service_type[1])) assert service.secondary_endpoint.startswith( @@ -389,7 +389,7 @@ def test_creat_serv_w_connstr_custm_domain(self, **kwargs): # Arrange for service_type in SERVICES.items(): conn_string = 'AccountName={};AccountKey={};BlobEndpoint=www.mydomain.com;'.format( - storage_account_name, storage_account_key) + storage_account_name, storage_account_key.secret) # Act service = service_type[0].from_connection_string(conn_string, container_name="foo", blob_name="bar") @@ -398,7 +398,7 @@ def test_creat_serv_w_connstr_custm_domain(self, **kwargs): assert service is not None assert service.account_name == storage_account_name assert service.credential.account_name == storage_account_name - assert service.credential.account_key == storage_account_key + assert service.credential.account_key == storage_account_key.secret assert service.primary_endpoint.startswith('https://www.mydomain.com/') assert service.secondary_endpoint.startswith('https://' + storage_account_name + '-secondary.blob.core.windows.net') @@ -410,7 +410,7 @@ def test_creat_serv_w_connstr_custm_dom_trailing_slash(self, **kwargs): # Arrange for service_type in SERVICES.items(): conn_string = 'AccountName={};AccountKey={};BlobEndpoint=www.mydomain.com/;'.format( - storage_account_name, storage_account_key) + storage_account_name, storage_account_key.secret) # Act service = service_type[0].from_connection_string(conn_string, container_name="foo", blob_name="bar") @@ -419,7 +419,7 @@ def test_creat_serv_w_connstr_custm_dom_trailing_slash(self, **kwargs): assert service is not None assert service.account_name == storage_account_name assert service.credential.account_name == storage_account_name - assert service.credential.account_key == storage_account_key + assert service.credential.account_key == storage_account_key.secret assert service.primary_endpoint.startswith('https://www.mydomain.com/') assert service.secondary_endpoint.startswith('https://' + storage_account_name + '-secondary.blob.core.windows.net') @@ -431,7 +431,7 @@ def test_creat_serv_w_connstr_custm_dom_2ndry_override(self, **kwargs): # Arrange for service_type in SERVICES.items(): conn_string = 'AccountName={};AccountKey={};BlobEndpoint=www.mydomain.com/;'.format( - storage_account_name, storage_account_key) + storage_account_name, storage_account_key.secret) # Act service = service_type[0].from_connection_string( @@ -441,7 +441,7 @@ def test_creat_serv_w_connstr_custm_dom_2ndry_override(self, **kwargs): assert service is not None assert service.account_name == storage_account_name assert service.credential.account_name == storage_account_name - assert service.credential.account_key == storage_account_key + assert service.credential.account_key == storage_account_key.secret assert service.primary_endpoint.startswith('https://www.mydomain.com/') assert service.secondary_endpoint.startswith('https://www-sec.mydomain.com/') @@ -453,7 +453,7 @@ def test_creat_serv_w_connstr_fail_if_2ndry_wo_primary(self, **kwargs): for service_type in SERVICES.items(): # Arrange conn_string = 'AccountName={};AccountKey={};{}=www.mydomain.com;'.format( - storage_account_name, storage_account_key, + storage_account_name, storage_account_key.secret, _CONNECTION_ENDPOINTS_SECONDARY.get(service_type[1])) # Act @@ -471,7 +471,7 @@ def test_creat_serv_w_connstr_pass_if_2ndry_w_primary(self, **kwargs): # Arrange conn_string = 'AccountName={};AccountKey={};{}=www.mydomain.com;{}=www-sec.mydomain.com;'.format( storage_account_name, - storage_account_key, + storage_account_key.secret, _CONNECTION_ENDPOINTS.get(service_type[1]), _CONNECTION_ENDPOINTS_SECONDARY.get(service_type[1])) @@ -482,7 +482,7 @@ def test_creat_serv_w_connstr_pass_if_2ndry_w_primary(self, **kwargs): assert service is not None assert service.account_name == storage_account_name assert service.credential.account_name == storage_account_name - assert service.credential.account_key == storage_account_key + assert service.credential.account_key == storage_account_key.secret assert service.primary_endpoint.startswith('https://www.mydomain.com/') assert service.secondary_endpoint.startswith('https://www-sec.mydomain.com/') @@ -562,7 +562,7 @@ async def test_request_callback_signed_header(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - service = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + service = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) name = self.get_resource_name('cont') # Act @@ -585,7 +585,7 @@ async def test_response_callback(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - service = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + service = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) name = self.get_resource_name('cont') container = service.get_container_client(name) @@ -604,7 +604,7 @@ async def test_user_agent_default(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - service = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + service = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) def callback(response): assert 'User-Agent' in response.http_request.headers @@ -620,7 +620,7 @@ async def test_user_agent_custom(self, **kwargs): 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_name, "blob"), credential=storage_account_key.secret, user_agent=custom_app) def callback(response): assert 'User-Agent' in response.http_request.headers @@ -646,7 +646,7 @@ async def test_user_agent_append(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - service = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + service = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) def callback(response): assert 'User-Agent' in response.http_request.headers @@ -667,7 +667,7 @@ async def test_closing_pipeline_client(self, **kwargs): 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_name, "blob"), credential=storage_account_key.secret, container_name='foo', blob_name='bar') # Assert async with service: @@ -684,7 +684,7 @@ async def test_closing_pipeline_client_simple(self, **kwargs): 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_name, "blob"), credential=storage_account_key.secret, 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 7a8e98bc7b31..e4c1f32258ec 100644 --- a/sdk/storage/azure-storage-blob/tests/test_blob_encryption.py +++ b/sdk/storage/azure-storage-blob/tests/test_blob_encryption.py @@ -43,7 +43,7 @@ class TestStorageBlobEncryption(StorageRecordedTestCase): def _setup(self, storage_account_name, key): self.bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=key, + credential=key.secret, max_single_put_size=32 * 1024, max_block_size=4 * 1024, max_page_size=4 * 1024, @@ -80,7 +80,7 @@ def test_missing_attribute_kek_wrap(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - self.bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + self.bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) self.bsc.require_encryption = True valid_key = KeyWrapper('key1') @@ -114,7 +114,7 @@ def test_invalid_value_kek_wrap(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - self.bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + self.bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) self.bsc.require_encryption = True self.bsc.key_encryption_key = KeyWrapper('key1') 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 f9a23efee27e..9d36f4bf22b9 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 @@ -48,7 +48,7 @@ async def _setup(self, storage_account_name, key): # the tests would take too long to execute self.bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=key, + credential=key.secret, max_single_put_size=32 * 1024, max_block_size=4 * 1024, max_page_size=4 * 1024, @@ -84,7 +84,7 @@ async def test_missing_attribute_kek_wrap(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - self.bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + self.bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) self.bsc.require_encryption = True valid_key = KeyWrapper('key1') @@ -118,7 +118,7 @@ async def test_invalid_value_kek_wrap(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - self.bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + self.bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) self.bsc.require_encryption = True self.bsc.key_encryption_key = KeyWrapper('key1') diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_encryption_v2.py b/sdk/storage/azure-storage-blob/tests/test_blob_encryption_v2.py index b5af0e564204..cfe2664bed64 100644 --- a/sdk/storage/azure-storage-blob/tests/test_blob_encryption_v2.py +++ b/sdk/storage/azure-storage-blob/tests/test_blob_encryption_v2.py @@ -38,7 +38,7 @@ class TestStorageBlobEncryptionV2(StorageRecordedTestCase): def _setup(self, storage_account_name, key): self.bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=key) + credential=key.secret) self.container_name = self.get_resource_name('utcontainer') if self.is_live: @@ -65,7 +65,7 @@ def test_v2_blocked_for_page_blob_upload(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - self.bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + self.bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) kek = KeyWrapper('key1') self.enable_encryption_v2(kek) @@ -133,7 +133,7 @@ def test_validate_encryption_chunked_upload(self, **kwargs): kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, max_block_size=1024, require_encryption=True, @@ -475,7 +475,7 @@ def test_put_blob_single_region_chunked(self, **kwargs): kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, max_block_size=1024, require_encryption=True, @@ -502,7 +502,7 @@ def test_put_blob_multi_region_chunked_size_equal_region(self, **kwargs): kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, max_block_size=4 * MiB, require_encryption=True, @@ -529,7 +529,7 @@ def test_put_blob_multi_region_chunked_size_equal_region_concurrent(self, **kwar kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, max_block_size=4 * MiB, require_encryption=True, @@ -556,7 +556,7 @@ def test_put_blob_multi_region_chunked_size_less_region(self, **kwargs): kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, max_block_size=2 * MiB, require_encryption=True, @@ -583,7 +583,7 @@ def test_put_blob_multi_region_chunked_size_greater_region(self, **kwargs): kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, max_block_size=6 * MiB, require_encryption=True, @@ -610,7 +610,7 @@ def test_put_blob_other_data_types(self, **kwargs): kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, require_encryption=True, encryption_version='2.0', key_encryption_key=kek) @@ -651,7 +651,7 @@ def test_put_blob_other_data_types_chunked(self, **kwargs): kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, max_block_size=1024, require_encryption=True, @@ -873,7 +873,7 @@ def test_get_blob_chunked_size_equal_region_size(self, **kwargs): kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=4 * MiB, max_chunk_get_size=4 * MiB, require_encryption=True, @@ -900,7 +900,7 @@ def test_get_blob_range_chunked(self, **kwargs): kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=4 * MiB, max_chunk_get_size=4 * MiB, require_encryption=True, @@ -928,7 +928,7 @@ def test_get_blob_chunked_size_equal_region_size_concurrent(self, **kwargs): kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=4 * MiB, max_chunk_get_size=4 * MiB, require_encryption=True, @@ -955,7 +955,7 @@ def test_get_blob_chunked_size_less_than_region_size(self, **kwargs): kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=4 * MiB, max_chunk_get_size=2 * MiB, require_encryption=True, @@ -982,7 +982,7 @@ def test_get_blob_chunked_size_greater_than_region_size(self, **kwargs): kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=4 * MiB, max_chunk_get_size=6 * MiB, require_encryption=True, @@ -1009,7 +1009,7 @@ def test_get_blob_using_chunks_iter(self, **kwargs): kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=4 * MiB, max_chunk_get_size=4 * MiB, require_encryption=True, @@ -1041,7 +1041,7 @@ def test_get_blob_using_read(self, **kwargs): kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=4 * MiB, max_chunk_get_size=4 * MiB, require_encryption=True, @@ -1078,7 +1078,7 @@ def test_get_blob_read_with_other_read_operations_ranged(self, **kwargs): kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=4 * MiB, max_chunk_get_size=4 * MiB, require_encryption=True, @@ -1128,7 +1128,7 @@ def test_get_blob_using_read_chars(self, **kwargs): kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=1024, max_chunk_get_size=1024, require_encryption=True, @@ -1222,7 +1222,7 @@ def assert_user_agent(request): # Test client constructor level keyword bsc = BlobServiceClient( self.bsc.url, - credential=storage_account_key, + credential=storage_account_key.secret, require_encryption=True, encryption_version='2.0', key_encryption_key=kek, diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_encryption_v2_async.py b/sdk/storage/azure-storage-blob/tests/test_blob_encryption_v2_async.py index 80ff56a01dfe..671800a8ed45 100644 --- a/sdk/storage/azure-storage-blob/tests/test_blob_encryption_v2_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_blob_encryption_v2_async.py @@ -40,7 +40,7 @@ class TestStorageBlobEncryptionV2Async(AsyncStorageRecordedTestCase): async def _setup(self, storage_account_name, key): self.bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=key) + credential=key.secret) self.container_name = self.get_resource_name('utcontainer') if self.is_live: @@ -67,7 +67,7 @@ async def test_v2_blocked_for_page_blob_upload(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - self.bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + self.bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) kek = KeyWrapper('key1') self.enable_encryption_v2(kek) @@ -135,7 +135,7 @@ async def test_validate_encryption_chunked_upload(self, **kwargs): kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, max_block_size=1024, require_encryption=True, @@ -477,7 +477,7 @@ async def test_put_blob_single_region_chunked(self, **kwargs): kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, max_block_size=1024, require_encryption=True, @@ -505,7 +505,7 @@ async def test_put_blob_multi_region_chunked_size_equal_region(self, **kwargs): kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, max_block_size=4 * MiB, require_encryption=True, @@ -532,7 +532,7 @@ async def test_put_blob_multi_region_chunked_size_equal_region_concurrent(self, kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, max_block_size=4 * MiB, require_encryption=True, @@ -559,7 +559,7 @@ async def test_put_blob_multi_region_chunked_size_less_region(self, **kwargs): kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, max_block_size=2 * MiB, require_encryption=True, @@ -586,7 +586,7 @@ async def test_put_blob_multi_region_chunked_size_greater_region(self, **kwargs) kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, max_block_size=6 * MiB, require_encryption=True, @@ -613,7 +613,7 @@ async def test_put_blob_other_data_types(self, **kwargs): kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, require_encryption=True, encryption_version='2.0', key_encryption_key=kek) @@ -660,7 +660,7 @@ async def test_put_blob_other_data_types_chunked(self, **kwargs): kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, require_encryption=True, encryption_version='2.0', key_encryption_key=kek) @@ -885,7 +885,7 @@ async def test_get_blob_chunked_size_equal_region_size(self, **kwargs): kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=4 * MiB, max_chunk_get_size=4 * MiB, require_encryption=True, @@ -912,7 +912,7 @@ async def test_get_blob_range_chunked(self, **kwargs): kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=4 * MiB, max_chunk_get_size=4 * MiB, require_encryption=True, @@ -940,7 +940,7 @@ async def test_get_blob_chunked_size_equal_region_size_concurrent(self, **kwargs kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=4 * MiB, max_chunk_get_size=4 * MiB, require_encryption=True, @@ -967,7 +967,7 @@ async def test_get_blob_chunked_size_less_than_region_size(self, **kwargs): kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=4 * MiB, max_chunk_get_size=2 * MiB, require_encryption=True, @@ -994,7 +994,7 @@ async def test_get_blob_chunked_size_greater_than_region_size(self, **kwargs): kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=4 * MiB, max_chunk_get_size=6 * MiB, require_encryption=True, @@ -1021,7 +1021,7 @@ async def test_get_blob_using_chunks_iter(self, **kwargs): kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=4 * MiB, max_chunk_get_size=4 * MiB, require_encryption=True, @@ -1053,7 +1053,7 @@ async def test_get_blob_using_read(self, **kwargs): kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=4 * MiB, max_chunk_get_size=4 * MiB, require_encryption=True, @@ -1090,7 +1090,7 @@ async def test_get_blob_read_with_other_read_operations_ranged(self, **kwargs): kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=4 * MiB, max_chunk_get_size=4 * MiB, require_encryption=True, @@ -1140,7 +1140,7 @@ async def test_get_blob_using_read_chars(self, **kwargs): kek = KeyWrapper('key1') bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=1024, max_chunk_get_size=1024, require_encryption=True, @@ -1234,7 +1234,7 @@ def assert_user_agent(request): # Test client constructor level keyword bsc = BlobServiceClient( self.bsc.url, - credential=storage_account_key, + credential=storage_account_key.secret, require_encryption=True, encryption_version='2.0', key_encryption_key=kek, 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 75cacc6291cf..9228730dc2f6 100644 --- a/sdk/storage/azure-storage-blob/tests/test_blob_retry.py +++ b/sdk/storage/azure-storage-blob/tests/test_blob_retry.py @@ -39,7 +39,7 @@ def test_retry_put_block_with_seekable_stream(self, **kwargs): retry = ExponentialRetry(initial_backoff=1, increment_base=2, retry_total=3) bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, retry_policy=retry ) @@ -79,7 +79,7 @@ def test_retry_put_block_with_non_seekable_stream(self, **kwargs): retry = ExponentialRetry(initial_backoff=1, increment_base=2, retry_total=3) bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, retry_policy=retry ) 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 64020c92ff99..1b6c89d96d0b 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 @@ -44,7 +44,7 @@ async def test_retry_put_block_with_seekable_stream(self, **kwargs): retry = ExponentialRetry(initial_backoff=1, increment_base=2, retry_total=3) bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, retry_policy=retry ) @@ -84,7 +84,7 @@ async def test_retry_put_block_with_non_seekable_stream(self, **kwargs): retry = ExponentialRetry(initial_backoff=1, increment_base=2, retry_total=3) bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, retry_policy=retry ) 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 3e0f559c41b3..3a035303c90d 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 @@ -112,7 +112,7 @@ def test_blob_service_properties(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) # Act resp = bsc.set_service_properties( analytics_logging=BlobAnalyticsLogging(), @@ -135,7 +135,7 @@ def test_empty_set_service_properties_exception(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) with pytest.raises(ValueError): bsc.set_service_properties() @@ -146,7 +146,7 @@ def test_set_default_service_version(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) # Act bsc.set_service_properties(target_version='2014-02-14') @@ -160,7 +160,7 @@ def test_set_delete_retention_policy(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) delete_retention_policy = RetentionPolicy(enabled=True, days=2) # Act @@ -176,7 +176,7 @@ def test_set_delete_retention_policy_edge_cases(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) delete_retention_policy = RetentionPolicy(enabled=True, days=1) bsc.set_service_properties(delete_retention_policy=delete_retention_policy) @@ -218,7 +218,7 @@ def test_set_disabled_delete_retention_policy(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) delete_retention_policy = RetentionPolicy(enabled=False) # Act @@ -234,7 +234,7 @@ def test_set_static_website_properties(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) static_website = StaticWebsite( enabled=True, index_document="index.html", @@ -253,7 +253,7 @@ def test_set_static_website_properties_with_default_index_document_path(self, ** storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) static_website = StaticWebsite( enabled=True, error_document404_path="errors/error/404error.html", @@ -272,7 +272,7 @@ def test_set_static_website_properties_missing_field(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) # Case1: Arrange both missing static_website = StaticWebsite(enabled=True) @@ -310,7 +310,7 @@ def test_disabled_static_website_properties(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) static_website = StaticWebsite(enabled=False, index_document="index.html", error_document404_path="errors/error/404error.html") @@ -327,7 +327,7 @@ def test_set_static_website_props_dont_impact_other_props(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) cors_rule1 = CorsRule(['www.xyz.com'], ['GET']) allowed_origins = ['www.xyz.com', "www.ab.com", "www.bc.com"] @@ -369,7 +369,7 @@ def test_set_logging(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) logging = BlobAnalyticsLogging(read=True, write=True, delete=True, retention_policy=RetentionPolicy(enabled=True, days=5)) # Act @@ -385,7 +385,7 @@ def test_set_hour_metrics(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) hour_metrics = Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=5)) # Act @@ -401,7 +401,7 @@ def test_set_minute_metrics(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) minute_metrics = Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=5)) @@ -418,7 +418,7 @@ def test_set_cors(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) cors_rule1 = CorsRule(['www.xyz.com'], ['GET']) allowed_origins = ['www.xyz.com', "www.ab.com", "www.bc.com"] @@ -451,7 +451,7 @@ def test_get_service_properties_account_sas(self, **kwargs): # Arrange sas_token = generate_account_sas( account_name=storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, resource_types=ResourceTypes(service=True), permission=AccountSasPermissions(read=True), expiry=datetime.utcnow() + timedelta(hours=3) @@ -471,7 +471,7 @@ def test_retention_no_days(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) pytest.raises(ValueError, RetentionPolicy, True, None) @@ -482,7 +482,7 @@ def test_too_many_cors_rules(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) cors = [] for i in range(0, 6): cors.append(CorsRule(['www.xyz.com'], ['GET'])) @@ -497,7 +497,7 @@ def test_retention_too_long(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) 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 ab3265bcdf33..819a1ef5645d 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 @@ -110,7 +110,7 @@ async def test_empty_set_service_properties_exception(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) with pytest.raises(ValueError): await bsc.set_service_properties() @@ -120,7 +120,7 @@ async def test_blob_service_properties(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) # Act resp = await bsc.set_service_properties( @@ -144,7 +144,7 @@ async def test_set_default_service_version(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) # Act await bsc.set_service_properties(target_version='2014-02-14') @@ -159,7 +159,7 @@ async def test_set_delete_retention_policy(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) delete_retention_policy = RetentionPolicy(enabled=True, days=2) # Act @@ -176,7 +176,7 @@ async def test_set_delete_retention_policy_edge_cases(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Should work with minimum settings - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) delete_retention_policy = RetentionPolicy(enabled=True, days=1) await bsc.set_service_properties(delete_retention_policy=delete_retention_policy) @@ -219,7 +219,7 @@ async def test_set_disabled_delete_retention_policy(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) delete_retention_policy = RetentionPolicy(enabled=False) # Act @@ -235,7 +235,7 @@ async def test_set_static_website_properties(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) static_website = StaticWebsite( enabled=True, index_document="index.html", @@ -254,7 +254,7 @@ async def test_set_static_website_properties_with_default_index_document_path(se storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) static_website = StaticWebsite( enabled=True, error_document404_path="errors/error/404error.html", @@ -274,7 +274,7 @@ async def test_set_static_web_props_missing_field(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Case1: Arrange both missing - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) static_website = StaticWebsite(enabled=True) @@ -311,7 +311,7 @@ async def test_disabled_static_website_properties(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) static_website = StaticWebsite(enabled=False, index_document="index.html", error_document404_path="errors/error/404error.html") @@ -328,7 +328,7 @@ async def test_set_static_webprops_no_impact_other_props(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) cors_rule1 = CorsRule(['www.xyz.com'], ['GET']) allowed_origins = ['www.xyz.com', "www.ab.com", "www.bc.com"] @@ -352,7 +352,7 @@ async def test_set_static_webprops_no_impact_other_props(self, **kwargs): 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) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) static_website = StaticWebsite(enabled=True, index_document="index.html", error_document404_path="errors/error/404error.html") @@ -370,7 +370,7 @@ async def test_set_logging(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) logging = BlobAnalyticsLogging(read=True, write=True, delete=True, retention_policy=RetentionPolicy(enabled=True, days=5)) # Act @@ -386,7 +386,7 @@ async def test_set_hour_metrics(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) hour_metrics = Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=5)) # Act @@ -402,7 +402,7 @@ async def test_set_minute_metrics(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) minute_metrics = Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=5)) @@ -419,7 +419,7 @@ async def test_set_cors(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) cors_rule1 = CorsRule(['www.xyz.com'], ['GET']) allowed_origins = ['www.xyz.com', "www.ab.com", "www.bc.com"] @@ -452,7 +452,7 @@ async def test_get_service_properties_account_sas(self, **kwargs): # Arrange sas_token = generate_account_sas( account_name=storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, resource_types=ResourceTypes(service=True), permission=AccountSasPermissions(read=True), expiry=datetime.utcnow() + timedelta(hours=3) @@ -482,7 +482,7 @@ async def test_too_many_cors_rules(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) cors = [] for i in range(0, 6): cors.append(CorsRule(['www.xyz.com'], ['GET'])) @@ -497,7 +497,7 @@ async def test_retention_too_long(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) 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 f22c81764957..968a7039ae94 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 @@ -41,7 +41,7 @@ def test_blob_service_stats(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bs = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bs = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) # Act stats = bs.get_service_stats() @@ -60,7 +60,7 @@ def test_blob_service_stats_when_unavailable(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bs = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bs = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) # Act stats = bs.get_service_stats() 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 9411ab0eab88..5bdf8dc75693 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 @@ -41,7 +41,7 @@ async def test_blob_service_stats(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bs = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bs = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) # Act stats = await bs.get_service_stats() @@ -57,7 +57,7 @@ async def test_blob_service_stats_when_unavailable(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bs = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bs = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) # Act stats = await bs.get_service_stats() 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 123fd2b50e46..1f93d40bcdf9 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 @@ -47,7 +47,7 @@ def test_standard_blob_tier_set_tier_api(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) self._setup(bsc) tiers = [StandardBlobTier.Archive, StandardBlobTier.Cool, StandardBlobTier.Hot] @@ -80,7 +80,7 @@ def test_set_standard_blob_tier_with_rehydrate_priority(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) self._setup(bsc) blob_client = self._create_blob(bsc) blob_tier = StandardBlobTier.Archive @@ -102,7 +102,7 @@ def test_rehydration_status(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) 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 82b1ee006244..bb5638227afd 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 @@ -48,7 +48,7 @@ async def test_standard_blob_tier_set_tier_api(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) await self._setup(bsc) tiers = [StandardBlobTier.Archive, StandardBlobTier.Cool, StandardBlobTier.Hot] @@ -81,7 +81,7 @@ async def test_set_std_blob_tier_w_rehydrate_priority(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) await self._setup(bsc) blob_client = await self._create_blob(bsc) blob_tier = StandardBlobTier.Archive @@ -103,7 +103,7 @@ async def test_rehydration_status(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) 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_blob_tags.py b/sdk/storage/azure-storage-blob/tests/test_blob_tags.py index cac5292e51ad..588972402149 100644 --- a/sdk/storage/azure-storage-blob/tests/test_blob_tags.py +++ b/sdk/storage/azure-storage-blob/tests/test_blob_tags.py @@ -96,7 +96,7 @@ def test_set_blob_tags(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - self._setup(storage_account_name, storage_account_key) + self._setup(storage_account_name, storage_account_key.secret) blob_client, _ = self._create_block_blob() # Act @@ -112,7 +112,7 @@ def test_set_blob_tags_with_lease(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - self._setup(storage_account_name, storage_account_key) + self._setup(storage_account_name, storage_account_key.secret) blob_client, _ = self._create_block_blob() lease = blob_client.acquire_lease(lease_id='00000000-1111-2222-3333-444444444444') @@ -138,7 +138,7 @@ def test_set_blob_tags_for_a_version(self, **kwargs): versioned_storage_account_name = kwargs.pop("versioned_storage_account_name") versioned_storage_account_key = kwargs.pop("versioned_storage_account_key") - self._setup(versioned_storage_account_name, versioned_storage_account_key) + self._setup(versioned_storage_account_name, versioned_storage_account_key.secret) # use this version to set tag blob_client, resp = self._create_block_blob() self._create_block_blob() @@ -156,7 +156,7 @@ def test_get_blob_tags(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - self._setup(storage_account_name, storage_account_key) + self._setup(storage_account_name, storage_account_key.secret) blob_client, resp = self._create_block_blob() # Act @@ -177,7 +177,7 @@ def test_get_blob_tags_for_a_snapshot(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - self._setup(storage_account_name, storage_account_key) + self._setup(storage_account_name, storage_account_key.secret) tags = {"+-./:=_ ": "firsttag", "tag2": "+-./:=_", "+-./:=_1": "+-./:=_"} blob_client, resp = self._create_block_blob(tags=tags) @@ -198,7 +198,7 @@ def test_upload_block_blob_with_tags(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - self._setup(storage_account_name, storage_account_key) + self._setup(storage_account_name, storage_account_key.secret) tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} blob_client, resp = self._create_block_blob(tags=tags) @@ -214,7 +214,7 @@ def test_get_blob_properties_returns_tags_num(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - self._setup(storage_account_name, storage_account_key) + self._setup(storage_account_name, storage_account_key.secret) tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} blob_client, resp = self._create_block_blob(tags=tags) @@ -232,7 +232,7 @@ def test_create_append_blob_with_tags(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - self._setup(storage_account_name, storage_account_key) + self._setup(storage_account_name, storage_account_key.secret) tags = {"+-./:=_ ": "firsttag", "tag2": "+-./:=_", "+-./:=_1": "+-./:=_"} blob_client, resp = self._create_append_blob(tags=tags) @@ -248,7 +248,7 @@ def test_create_page_blob_with_tags(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - self._setup(storage_account_name, storage_account_key) + self._setup(storage_account_name, storage_account_key.secret) tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} blob_client, resp = self._create_page_blob(tags=tags) @@ -264,7 +264,7 @@ def test_commit_block_list_with_tags(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - self._setup(storage_account_name, storage_account_key) + self._setup(storage_account_name, storage_account_key.secret) tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} blob_client, resp = self._create_empty_block_blob(tags={'condition tag': 'test tag'}) @@ -290,7 +290,7 @@ def test_start_copy_from_url_with_tags(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - self._setup(storage_account_name, storage_account_key) + self._setup(storage_account_name, storage_account_key.secret) tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} blob_client, resp = self._create_block_blob() @@ -322,7 +322,7 @@ def test_start_copy_from_url_with_tags_copy_tags(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - self._setup(storage_account_name, storage_account_key) + self._setup(storage_account_name, storage_account_key.secret) tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} source_blob = self.bsc.get_blob_client(self.container_name, self._get_blob_reference()) source_blob.upload_blob(b'Hello World', overwrite=True, tags=tags) @@ -332,7 +332,7 @@ def test_start_copy_from_url_with_tags_copy_tags(self, **kwargs): storage_account_name, self.container_name, source_blob.blob_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, permission=BlobSasPermissions(read=True, tag=True), expiry=datetime.utcnow() + timedelta(hours=1), ) @@ -363,7 +363,7 @@ def test_start_copy_from_url_with_tags_replace_tags(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - self._setup(storage_account_name, storage_account_key) + self._setup(storage_account_name, storage_account_key.secret) tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} tags2 = {"hello": "world"} source_blob = self.bsc.get_blob_client(self.container_name, self._get_blob_reference()) @@ -374,7 +374,7 @@ def test_start_copy_from_url_with_tags_replace_tags(self, **kwargs): storage_account_name, self.container_name, source_blob.blob_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, permission=BlobSasPermissions(read=True), expiry=datetime.utcnow() + timedelta(hours=1), ) @@ -402,7 +402,7 @@ def test_list_blobs_returns_tags(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - self._setup(storage_account_name, storage_account_key) + self._setup(storage_account_name, storage_account_key.secret) tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} self._create_block_blob(tags=tags) container = self.bsc.get_container_client(self.container_name) @@ -420,7 +420,7 @@ def test_filter_blobs(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - self._setup(storage_account_name, storage_account_key) + self._setup(storage_account_name, storage_account_key.secret) container_name1 = self._create_container(prefix="container1") container_name2 = self._create_container(prefix="container2") container_name3 = self._create_container(prefix="container3") @@ -454,7 +454,7 @@ def test_filter_blobs_using_account_sas(self, **kwargs): token = generate_account_sas( storage_account_name, - storage_account_key, + storage_account_key.secret, ResourceTypes(service=True, container=True, object=True), AccountSasPermissions(write=True, list=True, read=True, delete_previous_version=True, tag=True, filter_by_tags=True), @@ -488,7 +488,7 @@ def test_set_blob_tags_using_blob_sas(self, **kwargs): token = generate_account_sas( storage_account_name, - storage_account_key, + storage_account_key.secret, ResourceTypes(service=True, container=True, object=True), AccountSasPermissions(write=True, list=True, read=True, delete_previous_version=True, tag=True, filter_by_tags=True), @@ -502,7 +502,7 @@ def test_set_blob_tags_using_blob_sas(self, **kwargs): storage_account_name, self.container_name, blob_client.blob_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, permission=BlobSasPermissions(delete_previous_version=True, tag=True), expiry=datetime.utcnow() + timedelta(hours=1), ) @@ -530,7 +530,7 @@ def test_blob_tags_conditional_headers(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - self._setup(storage_account_name, storage_account_key) + self._setup(storage_account_name, storage_account_key.secret) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_tags_async.py b/sdk/storage/azure-storage-blob/tests/test_blob_tags_async.py index 5122930fb33d..1ce683bf1178 100644 --- a/sdk/storage/azure-storage-blob/tests/test_blob_tags_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_blob_tags_async.py @@ -25,7 +25,7 @@ class TestStorageBlobTags(AsyncStorageRecordedTestCase): async def _setup(self, storage_account_name, key): - self.bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=key) + self.bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=key.secret) self.container_name = self.get_resource_name("container") if self.is_live: container = self.bsc.get_container_client(self.container_name) @@ -316,7 +316,7 @@ async def test_start_copy_from_url_with_tags_copy_tags(self, **kwargs): storage_account_name, self.container_name, source_blob.blob_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, permission=BlobSasPermissions(read=True, tag=True), expiry=datetime.utcnow() + timedelta(hours=1), ) @@ -358,7 +358,7 @@ async def test_start_copy_from_url_with_tags_replace_tags(self, **kwargs): storage_account_name, self.container_name, source_blob.blob_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, permission=BlobSasPermissions(read=True), expiry=datetime.utcnow() + timedelta(hours=1), ) 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 c2bbd287940c..f6c3e0205cc3 100644 --- a/sdk/storage/azure-storage-blob/tests/test_block_blob.py +++ b/sdk/storage/azure-storage-blob/tests/test_block_blob.py @@ -56,7 +56,7 @@ def _setup(self, storage_account_name, key, container_name='utcontainer'): # otherwise the tests would take too long to execute self.bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=key, + credential=key.secret, max_single_put_size=1024, max_block_size=1024) self.config = self.bsc._config @@ -147,7 +147,7 @@ def test_upload_from_file_to_blob_with_oauth(self, **kwargs): # Set up destination blob without data blob_service_client = BlobServiceClient( account_url=self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) destination_blob_client = blob_service_client.get_blob_client( container=self.source_container_name, @@ -198,7 +198,7 @@ def test_stage_from_file_to_blob_with_oauth(self, **kwargs): # Set up destination blob without data blob_service_client = BlobServiceClient( account_url=self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) destination_blob_client = blob_service_client.get_blob_client( @@ -242,7 +242,7 @@ def test_upload_blob_with_and_without_overwrite(self, **kwargs): sas = self.generate_sas( generate_blob_sas, account_name=storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, container_name=self.container_name, blob_name=blob.blob_name, permission=BlobSasPermissions(read=True), @@ -274,7 +274,7 @@ def test_upload_blob_from_url_with_existing_blob(self, **kwargs): sas = self.generate_sas( generate_blob_sas, account_name=storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, container_name=self.container_name, blob_name=blob.blob_name, permission=BlobSasPermissions(read=True), @@ -304,7 +304,7 @@ def test_upload_blob_from_url_with_standard_tier_specified(self, **kwargs): sas = self.generate_sas( generate_blob_sas, account_name=storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, container_name=self.container_name, blob_name=blob.blob_name, permission=BlobSasPermissions(read=True), @@ -337,7 +337,7 @@ def test_upload_blob_from_url_with_metadata(self, **kwargs): sas = self.generate_sas( generate_blob_sas, account_name=storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, container_name=self.container_name, blob_name=blob.blob_name, permission=BlobSasPermissions(read=True), @@ -369,7 +369,7 @@ def test_upload_blob_from_url_with_cold_tier_specified(self, **kwargs): sas = self.generate_sas( generate_blob_sas, account_name=storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, container_name=self.container_name, blob_name=blob.blob_name, permission=BlobSasPermissions(read=True), @@ -400,7 +400,7 @@ def test_upload_blob_with_destination_lease(self, **kwargs): sas = self.generate_sas( generate_blob_sas, account_name=storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, container_name=self.container_name, blob_name=source_blob.blob_name, permission=BlobSasPermissions(read=True), @@ -437,7 +437,7 @@ def test_upload_blob_from_url_if_match_condition(self, **kwargs): sas = self.generate_sas( generate_blob_sas, account_name=storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, container_name=self.container_name, blob_name=source_blob.blob_name, permission=BlobSasPermissions(read=True), @@ -485,7 +485,7 @@ def test_upload_blob_from_url_with_cpk(self, **kwargs): sas = self.generate_sas( generate_blob_sas, account_name=storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, container_name=self.container_name, blob_name=source_blob.blob_name, permission=BlobSasPermissions(read=True), @@ -524,7 +524,7 @@ def test_upload_blob_from_url_overwrite_properties(self, **kwargs): sas = self.generate_sas( generate_blob_sas, account_name=storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, container_name=self.container_name, blob_name=source_blob.blob_name, permission=BlobSasPermissions(read=True), @@ -562,7 +562,7 @@ def test_upload_blob_from_url_with_source_content_md5(self, **kwargs): sas = self.generate_sas( generate_blob_sas, account_name=storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, container_name=self.container_name, blob_name=source_blob.blob_name, permission=BlobSasPermissions(read=True), @@ -605,7 +605,7 @@ def test_upload_blob_from_url_source_and_destination_properties(self, **kwargs): sas = self.generate_sas( generate_blob_sas, account_name=storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, container_name=self.container_name, blob_name=source_blob.blob_name, permission=BlobSasPermissions(read=True), @@ -1802,7 +1802,7 @@ def test_upload_progress_single_put(self, **kwargs): blob_client = BlobClient( self.account_url(storage_account_name, 'blob'), self.container_name, blob_name, - credential=storage_account_key) + credential=storage_account_key.secret) blob_client.upload_blob( data, @@ -1830,7 +1830,7 @@ def test_upload_progress_chunked_non_parallel(self, **kwargs): blob_client = BlobClient( self.account_url(storage_account_name, 'blob'), self.container_name, blob_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, max_block_size=1024) blob_client.upload_blob( @@ -1860,7 +1860,7 @@ def test_upload_progress_chunked_parallel(self, **kwargs): blob_client = BlobClient( self.account_url(storage_account_name, 'blob'), self.container_name, blob_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, max_block_size=1024) blob_client.upload_blob( @@ -1891,7 +1891,7 @@ def test_upload_progress_unknown_size(self, **kwargs): blob_client = BlobClient( self.account_url(storage_account_name, 'blob'), self.container_name, blob_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, max_block_size=1024) blob_client.upload_blob( 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 5105b8df961f..46f3db2e50b3 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 @@ -50,7 +50,7 @@ async def _setup(self, storage_account_name, key, container_name='utcontainer'): # otherwise the tests would take too long to execute self.bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=key, + credential=key.secret, max_single_put_size=1024, max_block_size=1024) self.config = self.bsc._config @@ -159,7 +159,7 @@ async def test_upload_from_file_to_blob_with_oauth(self, **kwargs): # Set up destination blob without data blob_service_client = BlobServiceClient( account_url=self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) destination_blob_client = blob_service_client.get_blob_client( container=self.source_container_name, @@ -212,7 +212,7 @@ async def test_stage_from_file_to_blob_with_oauth(self, **kwargs): # Set up destination blob without data blob_service_client = BlobServiceClient( account_url=self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) destination_blob_client = blob_service_client.get_blob_client( container=self.source_container_name, @@ -257,7 +257,7 @@ async def test_upload_blob_with_and_without_overwrite(self, **kwargs): sas = self.generate_sas( generate_blob_sas, account_name=storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, container_name=self.container_name, blob_name=blob.blob_name, permission=BlobSasPermissions(read=True), @@ -290,7 +290,7 @@ async def test_upload_blob_from_url_with_existing_blob(self, **kwargs): sas = self.generate_sas( generate_blob_sas, account_name=storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, container_name=self.container_name, blob_name=blob.blob_name, permission=BlobSasPermissions(read=True), @@ -321,7 +321,7 @@ async def test_upload_blob_from_url_with_standard_tier_specified(self, **kwargs) sas = self.generate_sas( generate_blob_sas, account_name=storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, container_name=self.container_name, blob_name=blob.blob_name, permission=BlobSasPermissions(read=True), @@ -354,7 +354,7 @@ async def test_upload_blob_from_url_with_metadata(self, **kwargs): sas = self.generate_sas( generate_blob_sas, account_name=storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, container_name=self.container_name, blob_name=blob.blob_name, permission=BlobSasPermissions(read=True), @@ -386,7 +386,7 @@ async def test_upload_blob_from_url_with_cold_tier_specified(self, **kwargs): sas = self.generate_sas( generate_blob_sas, account_name=storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, container_name=self.container_name, blob_name=blob.blob_name, permission=BlobSasPermissions(read=True), @@ -417,7 +417,7 @@ async def test_upload_blob_with_destination_lease(self, **kwargs): sas = self.generate_sas( generate_blob_sas, account_name=storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, container_name=self.container_name, blob_name=source_blob.blob_name, permission=BlobSasPermissions(read=True), @@ -454,7 +454,7 @@ async def test_upload_blob_from_url_if_match_condition(self, **kwargs): sas = self.generate_sas( generate_blob_sas, account_name=storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, container_name=self.container_name, blob_name=source_blob.blob_name, permission=BlobSasPermissions(read=True), @@ -503,7 +503,7 @@ async def test_upload_blob_from_url_with_cpk(self, **kwargs): sas = self.generate_sas( generate_blob_sas, account_name=storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, container_name=self.container_name, blob_name=source_blob.blob_name, permission=BlobSasPermissions(read=True), @@ -542,7 +542,7 @@ async def test_upload_blob_from_url_overwrite_properties(self, **kwargs): sas = self.generate_sas( generate_blob_sas, account_name=storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, container_name=self.container_name, blob_name=source_blob.blob_name, permission=BlobSasPermissions(read=True), @@ -579,7 +579,7 @@ async def test_upload_blob_from_url_with_source_content_md5(self, **kwargs): sas = self.generate_sas( generate_blob_sas, account_name=storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, container_name=self.container_name, blob_name=source_blob.blob_name, permission=BlobSasPermissions(read=True), @@ -624,7 +624,7 @@ async def test_upload_blob_from_url_source_and_destination_properties(self, **kw sas = self.generate_sas( generate_blob_sas, account_name=storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, container_name=self.container_name, blob_name=source_blob.blob_name, permission=BlobSasPermissions(read=True), @@ -1920,7 +1920,7 @@ async def test_upload_progress_single_put(self, **kwargs): blob_client = BlobClient( self.account_url(storage_account_name, 'blob'), self.container_name, blob_name, - credential=storage_account_key) + credential=storage_account_key.secret) await blob_client.upload_blob( data, @@ -1948,7 +1948,7 @@ async def test_upload_progress_chunked_non_parallel(self, **kwargs): blob_client = BlobClient( self.account_url(storage_account_name, 'blob'), self.container_name, blob_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, max_block_size=1024) await blob_client.upload_blob( @@ -1978,7 +1978,7 @@ async def test_upload_progress_chunked_parallel(self, **kwargs): blob_client = BlobClient( self.account_url(storage_account_name, 'blob'), self.container_name, blob_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, max_block_size=1024) await blob_client.upload_blob( @@ -2009,7 +2009,7 @@ async def test_upload_progress_unknown_size(self, **kwargs): blob_client = BlobClient( self.account_url(storage_account_name, 'blob'), self.container_name, blob_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, max_block_size=1024) await blob_client.upload_blob( 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 4acfc5fd998b..20a78f4216f1 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 @@ -36,7 +36,7 @@ def _setup(self, storage_account_name, key, container_prefix='utcontainer'): key = key.encode('utf-8') self.bsc = BlobServiceClient( account_url, - credential=key, + credential=key.secret, connection_data_block_size=4 * 1024, max_single_put_size=32 * 1024, max_block_size=4 * 1024) 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 47ec8333194f..c0c51ac3e044 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 @@ -29,7 +29,7 @@ async def _setup(self, storage_account_name, key): # otherwise the tests would take too long to execute self.bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=key, + credential=key.secret, connection_data_block_size=4 * 1024, max_single_put_size=32 * 1024, max_block_size=4 * 1024, 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 713107c6c258..17ea27de2141 100644 --- a/sdk/storage/azure-storage-blob/tests/test_common_blob.py +++ b/sdk/storage/azure-storage-blob/tests/test_common_blob.py @@ -65,7 +65,7 @@ class TestStorageCommonBlob(StorageRecordedTestCase): def _setup(self, storage_account_name, key): - self.bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=key) + self.bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=key.secret) self.container_name = self.get_resource_name('utcontainer') self.source_container_name = self.get_resource_name('utcontainersource') if self.is_live: @@ -91,7 +91,7 @@ def _create_source_blob(self, data): return blob_client def _setup_remote(self, storage_account_name, key): - self.bsc2 = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=key) + self.bsc2 = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=key.secret) self.remote_container_name = 'rmt' def _teardown(self, file_path): @@ -186,7 +186,7 @@ def test_copy_from_file_to_blob_with_oauth(self, **kwargs): # Set up destination blob without data blob_service_client = BlobServiceClient( account_url=self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) destination_blob_client = blob_service_client.get_blob_client( container=self.source_container_name, @@ -455,7 +455,7 @@ def test_create_blob_with_requests(self, **kwargs): blob.account_name, blob.container_name, blob.blob_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, permission=BlobSasPermissions(read=True), expiry=datetime.utcnow() + timedelta(hours=1), ) @@ -1098,7 +1098,7 @@ def test_delete_blob_version_with_blob_sas(self, **kwargs): blob_client.container_name, blob_client.blob_name, version_id=version_id, - account_key=versioned_storage_account_key, + account_key=versioned_storage_account_key.secret, permission=BlobSasPermissions(delete=True, delete_previous_version=True), expiry=datetime.utcnow() + timedelta(hours=1), ) @@ -2148,7 +2148,7 @@ def test_multiple_services_sas(self, **kwargs): token = self.generate_sas( generate_account_sas, storage_account_name, - storage_account_key, + storage_account_key.secret, ResourceTypes(container=True, object=True, service=True), AccountSasPermissions(read=True, list=True), datetime.utcnow() + timedelta(hours=1), @@ -2293,7 +2293,7 @@ def test_azure_named_key_credential_access(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - named_key = AzureNamedKeyCredential(storage_account_name, storage_account_key) + named_key = AzureNamedKeyCredential(storage_account_name, storage_account_key.secret) bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), named_key) container_name = self._get_container_reference() @@ -2627,7 +2627,7 @@ def test_get_account_information_sas(self, **kwargs): account_token = self.generate_sas( generate_account_sas, account_name=storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, resource_types=ResourceTypes(service=True), permission=AccountSasPermissions(read=True), expiry=datetime.utcnow() + timedelta(hours=1), @@ -2637,7 +2637,7 @@ def test_get_account_information_sas(self, **kwargs): generate_container_sas, account_name=storage_account_name, container_name=self.container_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, permission=ContainerSasPermissions(read=True), expiry=datetime.utcnow() + timedelta(hours=1), ) @@ -2647,7 +2647,7 @@ def test_get_account_information_sas(self, **kwargs): account_name=storage_account_name, container_name=self.container_name, blob_name=self._get_blob_reference(), - account_key=storage_account_key, + account_key=storage_account_key.secret, permission=BlobSasPermissions(read=True), expiry=datetime.utcnow() + timedelta(hours=1), ) @@ -2812,7 +2812,7 @@ def test_download_to_file_with_credential(self, **kwargs): # Act with tempfile.TemporaryFile() as temp_file: - download_blob_from_url(source_blob.url, temp_file, credential=storage_account_key) + download_blob_from_url(source_blob.url, temp_file, credential=storage_account_key.secret) temp_file.seek(0) # Assert actual = temp_file.read() @@ -2830,7 +2830,7 @@ def test_download_to_stream_with_credential(self, **kwargs): # Act with tempfile.TemporaryFile() as temp_file: - download_blob_from_url(source_blob.url, temp_file, credential=storage_account_key) + download_blob_from_url(source_blob.url, temp_file, credential=storage_account_key.secret) temp_file.seek(0) # Assert actual = temp_file.read() @@ -2848,7 +2848,7 @@ def test_download_to_file_with_existing_file(self, **kwargs): # Act with tempfile.NamedTemporaryFile(delete=False) as temp_file: - download_blob_from_url(source_blob.url, temp_file.name, credential=storage_account_key, overwrite=True) + download_blob_from_url(source_blob.url, temp_file.name, credential=storage_account_key.secret, overwrite=True) with pytest.raises(ValueError): download_blob_from_url(source_blob.url, temp_file.name) @@ -2875,13 +2875,13 @@ def test_download_to_file_with_existing_file_overwrite(self, **kwargs): # Act download_blob_from_url( source_blob.url, file_path, - credential=storage_account_key) + credential=storage_account_key.secret) data2 = b'ABC' * 1024 source_blob = self._create_blob(data=data2) download_blob_from_url( source_blob.url, file_path, overwrite=True, - credential=storage_account_key) + credential=storage_account_key.secret) # Assert with open(file_path, 'rb') as stream: @@ -2933,7 +2933,7 @@ def test_upload_to_url_bytes_with_credential(self, **kwargs): # Act uploaded = upload_blob_to_url( - blob.url, data, credential=storage_account_key) + blob.url, data, credential=storage_account_key.secret) # Assert assert uploaded is not None @@ -2955,7 +2955,7 @@ def test_upload_to_url_bytes_with_existing_blob(self, **kwargs): # Act with pytest.raises(ResourceExistsError): upload_blob_to_url( - blob.url, data, credential=storage_account_key) + blob.url, data, credential=storage_account_key.secret) # Assert content = blob.download_blob().readall() @@ -2977,7 +2977,7 @@ def test_upload_to_url_bytes_with_existing_blob_overwrite(self, **kwargs): uploaded = upload_blob_to_url( blob.url, data, overwrite=True, - credential=storage_account_key) + credential=storage_account_key.secret) # Assert assert uploaded is not None @@ -2997,7 +2997,7 @@ def test_upload_to_url_text_with_credential(self, **kwargs): # Act uploaded = upload_blob_to_url( - blob.url, data, credential=storage_account_key) + blob.url, data, credential=storage_account_key.secret) # Assert assert uploaded is not None @@ -3021,7 +3021,7 @@ def test_upload_to_url_file_with_credential(self, **kwargs): with tempfile.TemporaryFile() as temp_file: temp_file.write(data) temp_file.seek(0) - uploaded = upload_blob_to_url(blob.url, data, credential=storage_account_key) + uploaded = upload_blob_to_url(blob.url, data, credential=storage_account_key.secret) # Assert assert uploaded is not None @@ -3051,7 +3051,7 @@ def test_transport_closed_only_once(self, **kwargs): 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_name, "blob"), credential=storage_account_key.secret, transport=transport) blob_name = self._get_blob_reference() with bsc: bsc.get_service_properties() @@ -3461,7 +3461,7 @@ def test_blob_version_id_operations(self, **kwargs): blob_client.upload_blob(blob_data, overwrite=True) v1_props = blob_client.get_blob_properties() v1_blob = BlobClient(self.bsc.url, container_name=self.container_name, blob_name=blob_name, - version_id=v1_props['version_id'], credential=versioned_storage_account_key) + version_id=v1_props['version_id'], credential=versioned_storage_account_key.secret) blob_client.upload_blob(blob_data * 2, overwrite=True) v2_props = blob_client.get_blob_properties() v2_blob = container.get_blob_client(v2_props, version_id=v2_props['version_id']) @@ -3694,7 +3694,7 @@ def test_download_blob_no_decompress_chunks(self, **kwargs): account_url=self.account_url(storage_account_name, "blob"), container_name=self.container_name, blob_name = blob_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_chunk_get_size=4, max_single_get_size=4, ) 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 74de8d8168a9..161451f893dd 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 @@ -70,7 +70,7 @@ class TestStorageCommonBlobAsync(AsyncStorageRecordedTestCase): # --Helpers----------------------------------------------------------------- async def _setup(self, storage_account_name, key): - self.bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=key) + self.bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=key.secret) self.container_name = self.get_resource_name('utcontainer') self.source_container_name = self.get_resource_name('utcontainersource') self.byte_data = self.get_random_bytes(1024) @@ -100,7 +100,7 @@ async def _get_bearer_token_string(self, resource: str = "https://storage.azure. return "Bearer " + access_token.token async def _setup_remote(self, storage_account_name, key): - self.bsc2 = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=key) + self.bsc2 = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=key.secret) self.remote_container_name = 'rmt' def _teardown(self, file_path): @@ -191,7 +191,7 @@ async def test_copy_from_file_to_blob_with_oauth(self, **kwargs): # Set up destination blob without data blob_service_client = BlobServiceClient( account_url=self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) destination_blob_client = blob_service_client.get_blob_client( container=self.source_container_name, @@ -743,7 +743,7 @@ async def test_create_blob_with_aiohttp(self, **kwargs): blob.account_name, blob.container_name, blob.blob_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, permission=BlobSasPermissions(read=True), expiry=datetime.utcnow() + timedelta(hours=1), ) @@ -1096,7 +1096,7 @@ async def test_no_server_encryption(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - self.bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + self.bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) self.container_name = self.get_resource_name('utcontainer') self.source_container_name = self.get_resource_name('utcontainersource') self.byte_data = self.get_random_bytes(1024) @@ -1342,7 +1342,7 @@ async def test_delete_blob_version_with_blob_sas(self, **kwargs): blob_client.container_name, blob_client.blob_name, version_id=version_id, - account_key=versioned_storage_account_key, + account_key=versioned_storage_account_key.secret, permission=BlobSasPermissions(delete=True, delete_previous_version=True), expiry=datetime.utcnow() + timedelta(hours=1), ) @@ -2328,7 +2328,7 @@ async def test_multiple_services_sas(self, **kwargs): token = self.generate_sas( generate_account_sas, storage_account_name, - storage_account_key, + storage_account_key.secret, ResourceTypes(container=True, object=True, service=True), AccountSasPermissions(read=True, list=True), datetime.utcnow() + timedelta(hours=1), @@ -2344,7 +2344,7 @@ async def test_azure_named_key_credential_access(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - named_key = AzureNamedKeyCredential(storage_account_name, storage_account_key) + named_key = AzureNamedKeyCredential(storage_account_name, storage_account_key.secret) bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), named_key) container_name = self._get_container_reference() @@ -2604,7 +2604,7 @@ async def test_get_account_information_sas(self, **kwargs): account_token = self.generate_sas( generate_account_sas, account_name=storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, resource_types=ResourceTypes(service=True), permission=AccountSasPermissions(read=True), expiry=datetime.utcnow() + timedelta(hours=1), @@ -2614,7 +2614,7 @@ async def test_get_account_information_sas(self, **kwargs): generate_container_sas, account_name=storage_account_name, container_name=self.container_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, permission=ContainerSasPermissions(read=True), expiry=datetime.utcnow() + timedelta(hours=1), ) @@ -2624,7 +2624,7 @@ async def test_get_account_information_sas(self, **kwargs): account_name=storage_account_name, container_name=self.container_name, blob_name=self._get_blob_reference(), - account_key=storage_account_key, + account_key=storage_account_key.secret, permission=BlobSasPermissions(read=True), expiry=datetime.utcnow() + timedelta(hours=1), ) @@ -2791,7 +2791,7 @@ async def test_download_to_file_with_credential(self, **kwargs): # Act with tempfile.TemporaryFile() as temp_file: - await download_blob_from_url(source_blob.url, temp_file, credential=storage_account_key) + await download_blob_from_url(source_blob.url, temp_file, credential=storage_account_key.secret) temp_file.seek(0) actual = temp_file.read() assert data == actual @@ -2808,7 +2808,7 @@ async def test_download_to_stream_with_credential(self, **kwargs): # Act with tempfile.TemporaryFile() as temp_file: - await download_blob_from_url(source_blob.url, temp_file, credential=storage_account_key) + await download_blob_from_url(source_blob.url, temp_file, credential=storage_account_key.secret) temp_file.seek(0) # Assert actual = temp_file.read() @@ -2826,7 +2826,7 @@ async def test_download_to_file_with_existing_file(self, **kwargs): # Act with tempfile.NamedTemporaryFile(delete=False) as temp_file: - await download_blob_from_url(source_blob.url, temp_file.name, credential=storage_account_key, overwrite=True) + await download_blob_from_url(source_blob.url, temp_file.name, credential=storage_account_key.secret, overwrite=True) with pytest.raises(ValueError): await download_blob_from_url(source_blob.url, temp_file.name) @@ -2853,13 +2853,13 @@ async def test_download_to_file_with_existing_file_overwrite(self, **kwargs): # Act await download_blob_from_url( source_blob.url, file_path, - credential=storage_account_key) + credential=storage_account_key.secret) data2 = b'ABC' * 1024 source_blob = await self._create_blob(data=data2) await download_blob_from_url( source_blob.url, file_path, overwrite=True, - credential=storage_account_key) + credential=storage_account_key.secret) # Assert with open(file_path, 'rb') as stream: @@ -2913,7 +2913,7 @@ async def test_upload_to_url_bytes_with_credential(self, **kwargs): # Act uploaded = await upload_blob_to_url( - blob.url, data, credential=storage_account_key) + blob.url, data, credential=storage_account_key.secret) # Assert assert uploaded is not None @@ -2936,7 +2936,7 @@ async def test_upload_to_url_bytes_with_existing_blob(self, **kwargs): # Act with pytest.raises(ResourceExistsError): await upload_blob_to_url( - blob.url, data, credential=storage_account_key) + blob.url, data, credential=storage_account_key.secret) # Assert content = await (await blob.download_blob()).readall() @@ -2959,7 +2959,7 @@ async def test_upload_to_url_bytes_with_existing_blob_overwrite(self, **kwargs): uploaded = await upload_blob_to_url( blob.url, data, overwrite=True, - credential=storage_account_key) + credential=storage_account_key.secret) # Assert assert uploaded is not None @@ -2980,7 +2980,7 @@ async def test_upload_to_url_text_with_credential(self, **kwargs): # Act uploaded = await upload_blob_to_url( - blob.url, data, credential=storage_account_key) + blob.url, data, credential=storage_account_key.secret) # Assert assert uploaded is not None @@ -3004,7 +3004,7 @@ async def test_upload_to_url_file_with_credential(self, **kwargs): with tempfile.TemporaryFile() as temp_file: temp_file.write(data) temp_file.seek(0) - uploaded = await upload_blob_to_url(blob.url, data, credential=storage_account_key) + uploaded = await upload_blob_to_url(blob.url, data, credential=storage_account_key.secret) # Assert assert uploaded is not None @@ -3019,7 +3019,7 @@ async def test_transport_closed_only_once(self, **kwargs): 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_name, "blob"), credential=storage_account_key.secret, transport=transport) blob_name = self._get_blob_reference() async with bsc: await bsc.get_service_properties() @@ -3392,7 +3392,7 @@ async def test_blob_version_id_operations(self, **kwargs): await blob_client.upload_blob(blob_data, overwrite=True) v1_props = await blob_client.get_blob_properties() v1_blob = BlobClient(self.bsc.url, container_name=self.container_name, blob_name=blob_name, - version_id=v1_props['version_id'], credential=versioned_storage_account_key) + version_id=v1_props['version_id'], credential=versioned_storage_account_key.secret) await blob_client.upload_blob(blob_data * 2, overwrite=True) v2_props = await blob_client.get_blob_properties() v2_blob = container.get_blob_client(v2_props, version_id=v2_props['version_id']) @@ -3630,7 +3630,7 @@ async def test_download_blob_no_decompress_chunks(self, **kwargs): account_url=self.account_url(storage_account_name, "blob"), container_name=self.container_name, blob_name=blob_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_chunk_get_size=4, max_single_get_size=4, ) diff --git a/sdk/storage/azure-storage-blob/tests/test_container.py b/sdk/storage/azure-storage-blob/tests/test_container.py index 44ec7c8322be..57c1e8904b05 100644 --- a/sdk/storage/azure-storage-blob/tests/test_container.py +++ b/sdk/storage/azure-storage-blob/tests/test_container.py @@ -60,7 +60,7 @@ def test_create_container(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container_name = self._get_container_reference() # Act @@ -76,7 +76,7 @@ def test_create_container_with_already_existing_container_fail_on_exist(self, ** storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container_name = self._get_container_reference() # Act @@ -95,7 +95,7 @@ def test_create_container_with_public_access_container(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container_name = self._get_container_reference() # Act @@ -112,7 +112,7 @@ def test_create_container_with_public_access_blob(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container_name = self._get_container_reference() # Act @@ -137,7 +137,7 @@ def test_create_container_with_metadata(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container_name = self._get_container_reference() metadata = {'hello': 'world', 'number': '42'} @@ -156,7 +156,7 @@ def test_container_exists_with_lease(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) container.acquire_lease(lease_id='00000000-1111-2222-3333-444444444444') @@ -172,7 +172,7 @@ def test_rename_container(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) old_name1 = self._get_container_reference(prefix="oldcontainer1") old_name2 = self._get_container_reference(prefix="oldcontainer2") new_name = self._get_container_reference(prefix="newcontainer") @@ -195,7 +195,7 @@ def test_rename_container(self, **kwargs): @BlobPreparer() def test_rename_container_with_container_client( self, storage_account_name, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) old_name1 = self._get_container_reference(prefix="oldcontainer1") old_name2 = self._get_container_reference(prefix="oldcontainer2") new_name = self._get_container_reference(prefix="newcontainer") @@ -222,7 +222,7 @@ def test_rename_container_with_source_lease(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) old_name = self._get_container_reference(prefix="old") new_name = self._get_container_reference(prefix="new") container = bsc.get_container_client(old_name) @@ -241,7 +241,7 @@ def test_unicode_create_container_unicode_name(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container_name = u'啊齄丂狛狜' container = bsc.get_container_client(container_name) @@ -256,7 +256,7 @@ def test_list_containers(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) # Act @@ -277,7 +277,7 @@ def test_list_system_containers(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) # Act containers = list(bsc.list_containers(include_system=True)) @@ -295,7 +295,7 @@ def test_list_containers_with_prefix(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) # Act @@ -314,7 +314,7 @@ def test_list_containers_with_include_metadata(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) metadata = {'hello': 'world', 'number': '42'} resp = container.set_container_metadata(metadata) @@ -339,7 +339,7 @@ def test_list_containers_with_public_access(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) expiry_time = self.get_datetime_variable(variables, 'expiry_time', datetime.utcnow() + timedelta(hours=1)) start_time = self.get_datetime_variable(variables, 'start_time', datetime.utcnow()) @@ -367,7 +367,7 @@ def test_list_containers_with_num_results_and_marker(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) prefix = 'listcontainersync' container_names = [] for i in range(0, 4): @@ -399,13 +399,13 @@ def test_list_containers_account_sas(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) sas_token = self.generate_sas( generate_account_sas, account_name=storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, resource_types=ResourceTypes(service=True), permission=AccountSasPermissions(list=True), expiry=datetime.utcnow() + timedelta(hours=3) @@ -428,7 +428,7 @@ def test_set_container_metadata(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) metadata = {'hello': 'world', 'number': '43'} container = self._create_container(bsc) @@ -444,7 +444,7 @@ def test_set_container_metadata_with_lease_id(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) metadata = {'hello': 'world', 'number': '43'} container = self._create_container(bsc) lease_id = container.acquire_lease(lease_id='00000000-1111-2222-3333-444444444444') @@ -462,7 +462,7 @@ def test_set_container_metadata_with_non_existing_container(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container_name = self._get_container_reference() container = bsc.get_container_client(container_name) @@ -478,7 +478,7 @@ def test_get_container_metadata(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) metadata = {'hello': 'world', 'number': '42'} container = self._create_container(bsc) container.set_container_metadata(metadata) @@ -495,7 +495,7 @@ def test_get_container_metadata_with_lease_id(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) metadata = {'hello': 'world', 'number': '42'} container = self._create_container(bsc) container.set_container_metadata(metadata) @@ -513,7 +513,7 @@ def test_container_exists(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container1 = self._create_container(bsc, prefix="container1") container2_name = self._get_container_reference(prefix="container2") @@ -528,7 +528,7 @@ def test_get_container_properties(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) metadata = {'hello': 'world', 'number': '42'} container = self._create_container(bsc) container.set_container_metadata(metadata) @@ -549,7 +549,7 @@ def test_get_container_properties_with_lease_id(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) metadata = {'hello': 'world', 'number': '42'} container = self._create_container(bsc) container.set_container_metadata(metadata) @@ -572,7 +572,7 @@ def test_get_container_acl(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) # Act @@ -589,7 +589,7 @@ def test_get_container_acl_with_lease_id(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) lease_id = container.acquire_lease(lease_id='00000000-1111-2222-3333-444444444444') @@ -607,7 +607,7 @@ def test_set_container_acl(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) # Act @@ -637,7 +637,7 @@ def test_set_container_acl_with_one_signed_identifier(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) # Act @@ -663,7 +663,7 @@ def test_set_container_acl_with_lease_id(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) lease_id = container.acquire_lease(lease_id='00000000-1111-2222-3333-444444444444') @@ -691,7 +691,7 @@ def test_set_container_acl_with_public_access(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) # Act @@ -708,7 +708,7 @@ def test_set_container_acl_with_empty_signed_identifiers(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) # Act @@ -726,7 +726,7 @@ def test_set_container_acl_with_empty_access_policy(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) identifier = {'empty': None} @@ -746,7 +746,7 @@ def test_set_container_acl_with_signed_identifiers(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) # Act @@ -772,7 +772,7 @@ def test_set_container_acl_with_empty_identifiers(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) identifiers = {i: None for i in range(2)} @@ -794,7 +794,7 @@ def test_set_container_acl_with_three_identifiers(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) expiry_time = self.get_datetime_variable(variables, 'expiry_time', datetime.utcnow() + timedelta(hours=1)) @@ -823,7 +823,7 @@ def test_set_container_acl_too_many_ids(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container_name = self._create_container(bsc) # Act @@ -842,7 +842,7 @@ def test_lease_container_acquire_and_release(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) # Act @@ -857,7 +857,7 @@ def test_lease_container_renew(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) lease = container.acquire_lease(lease_id='00000000-1111-2222-3333-444444444444', lease_duration=15) self.sleep(10) @@ -880,7 +880,7 @@ def test_lease_container_break_period(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) # Act @@ -898,7 +898,7 @@ def test_lease_container_break_released_lease_fails(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) lease = container.acquire_lease(lease_id='00000000-1111-2222-3333-444444444444') lease.release() @@ -915,7 +915,7 @@ def test_lease_container_with_duration(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) # Act @@ -933,7 +933,7 @@ def test_lease_container_twice(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) # Act @@ -949,7 +949,7 @@ def test_lease_container_with_proposed_lease_id(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) # Act @@ -965,7 +965,7 @@ def test_lease_container_change_lease_id(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) # Act @@ -988,7 +988,7 @@ def test_delete_container_with_existing_container(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) # Act @@ -1003,7 +1003,7 @@ def test_delete_container_with_non_existing_container_fail_not_exist(self, **kwa storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container_name = self._get_container_reference() container = bsc.get_container_client(container_name) @@ -1023,7 +1023,7 @@ def test_delete_container_with_lease_id(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) lease = container.acquire_lease(lease_id='00000000-1111-2222-3333-444444444444', lease_duration=15) @@ -1043,7 +1043,7 @@ def test_undelete_container(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # TODO: container soft delete should enabled by SRP call or use ARM, so make this test as playback only. - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container_client = self._create_container(bsc) # Act @@ -1075,7 +1075,7 @@ def test_restore_with_sas(self, **kwargs): token = self.generate_sas( generate_account_sas, storage_account_name, - storage_account_key, + storage_account_key.secret, ResourceTypes(service=True, container=True), AccountSasPermissions(read=True, write=True, list=True, delete=True), datetime.utcnow() + timedelta(hours=1), @@ -1106,7 +1106,7 @@ def test_list_names(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) data = b'hello world' @@ -1126,7 +1126,7 @@ def test_list_blobs_contains_last_access_time(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) data = b'hello world' @@ -1143,7 +1143,7 @@ def test_list_blobs_returns_rehydrate_priority(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) data = b'hello world' @@ -1162,7 +1162,7 @@ def test_list_blobs_cold_tier(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) data = b'hello world' @@ -1179,7 +1179,7 @@ def test_list_blobs(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) data = b'hello world' container.get_blob_client('blob1').upload_blob(data) @@ -1204,7 +1204,7 @@ def test_list_encoded_blobs(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) blob_name = "dir1/dir2/file\uFFFF.blob" container = self._create_container(bsc, prefix="cont1") data = b'hello world' @@ -1224,7 +1224,7 @@ def test_list_blobs_with_object_replication_policy(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = bsc.get_container_client('orp-source') data = b'hello world' b_c = container.get_blob_client('blob1') @@ -1250,7 +1250,7 @@ def test_list_blobs_leased_blob(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) data = b'hello world' blob1 = container.get_blob_client('blob1') @@ -1276,7 +1276,7 @@ def test_list_blobs_with_prefix(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) data = b'hello world' container.get_blob_client('blob_a1').upload_blob(data) @@ -1298,7 +1298,7 @@ def test_list_blobs_with_num_results(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) data = b'hello world' container.get_blob_client('blob_a1').upload_blob(data) @@ -1322,7 +1322,7 @@ def test_list_blobs_with_include_snapshots(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) data = b'hello world' blob1 = container.get_blob_client('blob1') @@ -1348,7 +1348,7 @@ def test_list_blobs_with_include_metadata(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) data = b'hello world' content_settings = ContentSettings( @@ -1380,7 +1380,7 @@ def test_list_blobs_include_deletedwithversion(self, **kwargs): versioned_storage_account_name = kwargs.pop("versioned_storage_account_name") versioned_storage_account_key = kwargs.pop("versioned_storage_account_key") - bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key) + bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key.secret) container = self._create_container(bsc) data = b'hello world' content_settings = ContentSettings( @@ -1418,7 +1418,7 @@ def test_list_blobs_with_include_uncommittedblobs(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) data = b'hello world' blob1 = container.get_blob_client('blob1') @@ -1443,7 +1443,7 @@ def test_list_blobs_with_include_copy(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) data = b'hello world' container.get_blob_client('blob1').upload_blob(data, metadata={'status': 'original'}) @@ -1483,7 +1483,7 @@ def test_list_blobs_with_delimiter(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) data = b'hello world' @@ -1508,7 +1508,7 @@ def test_find_blobs_by_tags(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc, 'testfind') data = b'hello world' @@ -1544,7 +1544,7 @@ def test_find_blobs_by_tags_container_sas(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) data = b'hello world' @@ -1562,7 +1562,7 @@ def test_find_blobs_by_tags_container_sas(self, **kwargs): generate_container_sas, container.account_name, container.container_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, permission=ContainerSasPermissions(filter_by_tags=True), expiry=datetime.utcnow() + timedelta(hours=1) ) @@ -1587,7 +1587,7 @@ def test_delete_blobs_simple(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) data = b'hello world' @@ -1617,7 +1617,7 @@ def test_delete_blob_with_properties_versioning(self, **kwargs): versioned_storage_account_name = kwargs.pop("versioned_storage_account_name") versioned_storage_account_key = kwargs.pop("versioned_storage_account_key") - bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key) + bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key.secret) container: ContainerClient = self._create_container(bsc) blob_name = self.get_resource_name("utcontainer") @@ -1650,7 +1650,7 @@ def test_delete_blobs_with_version_id(self, **kwargs): versioned_storage_account_key = kwargs.pop("versioned_storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key) + bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key.secret) container = self._create_container(bsc) data = b'hello world' @@ -1692,7 +1692,7 @@ def test_delete_blobs_with_properties_versioning(self, **kwargs): versioned_storage_account_name = kwargs.pop("versioned_storage_account_name") versioned_storage_account_key = kwargs.pop("versioned_storage_account_key") - bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key) + bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key.secret) container: ContainerClient = self._create_container(bsc) blob_name = self.get_resource_name("utcontainer") @@ -1728,13 +1728,13 @@ def test_batch_blobs_with_container_sas(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container_name = self._get_container_reference() sas_token = self.generate_sas( generate_container_sas, storage_account_name, container_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, permission=ContainerSasPermissions(read=True, write=True, delete=True, list=True), expiry=datetime.utcnow() + timedelta(hours=1) ) @@ -1771,7 +1771,7 @@ def test_delete_blobs_with_if_tags(self, **kwargs): blob_storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(blob_storage_account_name, "blob"), blob_storage_account_key) + bsc = BlobServiceClient(self.account_url(blob_storage_account_name, "blob"), blob_storage_account_key.secret) container = self._create_container(bsc) data = b'hello world' tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} @@ -1817,7 +1817,7 @@ def test_delete_blobs_and_snapshot_using_sas(self, **kwargs): sas_token = self.generate_sas( generate_account_sas, storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, resource_types=ResourceTypes(object=True, container=True), permission=AccountSasPermissions(read=True, write=True, delete=True, list=True), expiry=datetime.utcnow() + timedelta(hours=1) @@ -1870,7 +1870,7 @@ def test_delete_blobs_simple_no_raise(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) data = b'hello world' @@ -1901,7 +1901,7 @@ def test_delete_blobs_snapshot(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc, prefix="test") data = b'hello world' @@ -1941,7 +1941,7 @@ def test_standard_blob_tier_set_tier_api_batch(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) tiers = [StandardBlobTier.Archive, StandardBlobTier.Cool, StandardBlobTier.Hot] @@ -1996,7 +1996,7 @@ def test_batch_set_standard_blob_tier_for_version(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) container.upload_blob("blob1", "hello world") container.upload_blob("blob2", "hello world") @@ -2060,7 +2060,7 @@ def test_standard_blob_tier_with_if_tags(self, **kwargs): blob_storage_account_name = kwargs.pop("storage_account_name") blob_storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(blob_storage_account_name, "blob"), blob_storage_account_key) + bsc = BlobServiceClient(self.account_url(blob_storage_account_name, "blob"), blob_storage_account_key.secret) container = self._create_container(bsc) tier = StandardBlobTier.Cool tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} @@ -2121,7 +2121,7 @@ def test_standard_blob_tier_set_tiers_with_sas(self, **kwargs): sas_token = self.generate_sas( generate_account_sas, storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, resource_types=ResourceTypes(object=True, container=True), permission=AccountSasPermissions(read=True, write=True, delete=True, list=True), expiry=datetime.utcnow() + timedelta(hours=1) @@ -2180,7 +2180,7 @@ def test_premium_tier_set_tier_api_batch(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) url = self._get_premium_account_url() credential = self._get_premium_shared_key_credential() pbs = BlobServiceClient(url, credential=credential) @@ -2233,7 +2233,7 @@ def test_walk_blobs_with_delimiter(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) data = b'hello world' @@ -2263,7 +2263,7 @@ def test_walk_blobs_with_prefix_delimiter_versions(self, **kwargs): versioned_storage_account_name = kwargs.pop("versioned_storage_account_name") versioned_storage_account_key = kwargs.pop("versioned_storage_account_key") - bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key) + bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key.secret) container = self._create_container(bsc) data = b'hello world' @@ -2289,7 +2289,7 @@ def test_walk_blobs_cold_tier(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) data = b'hello world' @@ -2308,7 +2308,7 @@ def test_list_blobs_with_include_multiple(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) data = b'hello world' blob1 = container.get_blob_client('blob1') @@ -2342,7 +2342,7 @@ def test_shared_access_container(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) blob_name = 'blob1' data = b'hello world' @@ -2373,7 +2373,7 @@ def test_web_container_normal_operations_working(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret) # create the web container in case it does not exist yet container = bsc.get_container_client(web_container) @@ -2459,7 +2459,7 @@ def test_download_blob(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) data = b'hello world' blob_name = self.get_resource_name("blob") @@ -2477,7 +2477,7 @@ def test_download_blob_with_properties_versioning(self, **kwargs): versioned_storage_account_name = kwargs.pop("versioned_storage_account_name") versioned_storage_account_key = kwargs.pop("versioned_storage_account_key") - bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key) + bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key.secret) container: ContainerClient = self._create_container(bsc) blob_name = self.get_resource_name("utcontainer") @@ -2505,7 +2505,7 @@ def test_download_blob_in_chunks_where_maxsinglegetsize_is_multiple_of_chunksize storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key, + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret, max_single_get_size=1024, max_chunk_get_size=512) container = self._create_container(bsc) @@ -2534,7 +2534,7 @@ def test_get_blob_client_with_properties_versioning(self, **kwargs): versioned_storage_account_name = kwargs.pop("versioned_storage_account_name") versioned_storage_account_key = kwargs.pop("versioned_storage_account_key") - bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key) + bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key.secret) container: ContainerClient = self._create_container(bsc) blob_name = self.get_resource_name("utcontainer") @@ -2574,7 +2574,7 @@ def test_download_blob_modified(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key, + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret, max_single_get_size=38, max_chunk_get_size=38) container = self._create_container(bsc, prefix="cont") @@ -2598,7 +2598,7 @@ def test_download_blob_in_chunks_where_maxsinglegetsize_not_multiple_of_chunksiz storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key, + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret, max_single_get_size=1024, max_chunk_get_size=666) container = self._create_container(bsc) @@ -2627,7 +2627,7 @@ def test_download_blob_in_chunks_where_maxsinglegetsize_smallert_than_chunksize( storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key, + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret, max_single_get_size=215, max_chunk_get_size=512) container = self._create_container(bsc) @@ -2656,7 +2656,7 @@ def test_list_blob_names(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container: ContainerClient = self._create_container(bsc) data = b'hello world' @@ -2682,7 +2682,7 @@ def test_list_blob_names_pagination(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container: ContainerClient = self._create_container(bsc) data = b'hello world' @@ -2711,7 +2711,7 @@ def test_storage_account_audience_container_client(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - cc = ContainerClient(self.account_url(storage_account_name, "blob"), 'testcont', storage_account_key) + cc = ContainerClient(self.account_url(storage_account_name, "blob"), 'testcont', storage_account_key.secret) cc.exists() # Act @@ -2760,7 +2760,7 @@ def test_list_blobs_start_end(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) data = b'hello world' container.get_blob_client('blob1').upload_blob(data) @@ -2784,7 +2784,7 @@ def test_walk_blobs_start_end(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = self._create_container(bsc) data = b'hello world' container.get_blob_client('a/blob1').upload_blob(data) 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 516964565122..8ece5e29da65 100644 --- a/sdk/storage/azure-storage-blob/tests/test_container_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_container_async.py @@ -73,7 +73,7 @@ async def test_create_container(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key, retry_total=0) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret, retry_total=0) container_name = self._get_container_reference() # Act @@ -89,7 +89,7 @@ async def test_create_cntnr_w_existing_cntnr_fail_on_exist(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container_name = self._get_container_reference() # Act @@ -108,7 +108,7 @@ async def test_create_container_with_public_access_container(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container_name = self._get_container_reference() # Act @@ -125,7 +125,7 @@ async def test_create_container_with_public_access_blob(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container_name = self._get_container_reference() # Act @@ -150,7 +150,7 @@ async def test_create_container_with_metadata(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container_name = self._get_container_reference() metadata = {'hello': 'world', 'number': '42'} @@ -170,7 +170,7 @@ async def test_container_exists_with_lease(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) await container.acquire_lease(lease_id='00000000-1111-2222-3333-444444444444') @@ -187,7 +187,7 @@ async def test_rename_container(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) old_name1 = self._get_container_reference(prefix="oldcontainer1") old_name2 = self._get_container_reference(prefix="oldcontainer2") new_name = self._get_container_reference(prefix="newcontainer") @@ -213,7 +213,7 @@ async def test_download_blob_modified(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key, + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret, max_single_get_size=38, max_chunk_get_size=38) container = await self._create_container(bsc, prefix="cont1") @@ -235,7 +235,7 @@ async def test_download_blob_modified(self, **kwargs): @BlobPreparer() async def test_rename_container_with_container_client( self, storage_account_name, storage_account_key): - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) old_name1 = self._get_container_reference(prefix="oldcontainer1") old_name2 = self._get_container_reference(prefix="oldcontainer2") new_name = self._get_container_reference(prefix="newcontainer") @@ -264,7 +264,7 @@ async def test_rename_container_with_source_lease(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) old_name = self._get_container_reference(prefix="old") new_name = self._get_container_reference(prefix="new") container = bsc.get_container_client(old_name) @@ -284,7 +284,7 @@ async def test_unicode_create_container_unicode_name(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container_name = u'啊齄丂狛狜' container = bsc.get_container_client(container_name) @@ -301,7 +301,7 @@ async def test_list_containers(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) # Act @@ -325,7 +325,7 @@ async def test_list_system_containers(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) # Act containers = [] @@ -344,7 +344,7 @@ async def test_list_containers_with_prefix(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) # Act @@ -365,7 +365,7 @@ async def test_list_containers_with_include_metadata(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) metadata = {'hello': 'world', 'number': '42'} resp = await container.set_container_metadata(metadata) @@ -392,7 +392,7 @@ async def test_list_containers_with_public_access(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) expiry_time = self.get_datetime_variable(variables, 'expiry_time', datetime.utcnow() + timedelta(hours=1)) start_time = self.get_datetime_variable(variables, 'start_time', datetime.utcnow()) @@ -422,7 +422,7 @@ async def test_list_containers_with_num_results_and_marker(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) prefix = 'listcontainerasync' container_names = [] for i in range(0, 4): @@ -459,13 +459,13 @@ async def test_list_containers_account_sas(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) sas_token = self.generate_sas( generate_account_sas, account_name=storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, resource_types=ResourceTypes(service=True), permission=AccountSasPermissions(list=True), expiry=datetime.utcnow() + timedelta(hours=3) @@ -490,7 +490,7 @@ async def test_set_container_metadata(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) metadata = {'hello': 'world', 'number': '43'} container = await self._create_container(bsc) @@ -507,7 +507,7 @@ async def test_set_container_metadata_with_lease_id(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) metadata = {'hello': 'world', 'number': '43'} container = await self._create_container(bsc) lease_id = await container.acquire_lease(lease_id='00000000-1111-2222-3333-444444444444') @@ -526,7 +526,7 @@ async def test_set_container_metadata_with_non_existing_container(self, **kwargs storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container_name = self._get_container_reference() container = bsc.get_container_client(container_name) @@ -542,7 +542,7 @@ async def test_get_container_metadata(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) metadata = {'hello': 'world', 'number': '42'} container = await self._create_container(bsc) await container.set_container_metadata(metadata) @@ -560,7 +560,7 @@ async def test_get_container_metadata_with_lease_id(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) metadata = {'hello': 'world', 'number': '42'} container = await self._create_container(bsc) await container.set_container_metadata(metadata) @@ -580,7 +580,7 @@ async def test_container_exists(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") bsc = BlobServiceClient(self.account_url( - storage_account_name, "blob"), storage_account_key) + storage_account_name, "blob"), storage_account_key.secret) container1 = await self._create_container(bsc, prefix="container1") container2_name = self._get_container_reference(prefix="container2") @@ -596,7 +596,7 @@ async def test_get_container_properties(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") bsc = BlobServiceClient( - self.account_url(storage_account_name, "blob"), storage_account_key) + self.account_url(storage_account_name, "blob"), storage_account_key.secret) metadata = {'hello': 'world', 'number': '42'} container = await self._create_container(bsc) await container.set_container_metadata(metadata) @@ -617,7 +617,7 @@ async def test_get_container_properties_with_lease_id(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) metadata = {'hello': 'world', 'number': '42'} container = await self._create_container(bsc) await container.set_container_metadata(metadata) @@ -640,7 +640,7 @@ async def test_get_container_acl(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) # Act @@ -657,7 +657,7 @@ async def test_get_container_acl_with_lease_id(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) lease_id = await container.acquire_lease(lease_id='00000000-1111-2222-3333-444444444444') @@ -675,7 +675,7 @@ async def test_set_container_acl(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop('variables', {}) - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) # Act @@ -705,7 +705,7 @@ async def test_set_container_acl_with_one_signed_identifier(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) # Act @@ -731,7 +731,7 @@ async def test_set_container_acl_with_lease_id(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) lease_id = await container.acquire_lease(lease_id='00000000-1111-2222-3333-444444444444') @@ -759,7 +759,7 @@ async def test_set_container_acl_with_public_access(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) # Act @@ -784,7 +784,7 @@ async def test_set_container_acl_with_empty_signed_identifiers(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) # Act @@ -803,7 +803,7 @@ async def test_set_container_acl_with_signed_identifiers(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) # Act @@ -829,7 +829,7 @@ async def test_set_container_acl_with_empty_identifiers(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) identifiers = {i: None for i in range(0, 3)} @@ -851,7 +851,7 @@ async def test_set_container_acl_with_three_identifiers(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) expiry_time = self.get_datetime_variable(variables, 'expiry_time', datetime.utcnow() + timedelta(hours=1)) @@ -880,7 +880,7 @@ async def test_set_container_acl_too_many_ids(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container_name = await self._create_container(bsc) # Act @@ -899,7 +899,7 @@ async def test_lease_container_acquire_and_release(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) # Act @@ -914,7 +914,7 @@ async def test_lease_container_renew(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) lease = await container.acquire_lease(lease_id='00000000-1111-2222-3333-444444444444', lease_duration=15) self.sleep(10) @@ -937,7 +937,7 @@ async def test_lease_container_break_period(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) # Act @@ -955,7 +955,7 @@ async def test_lease_container_break_released_lease_fails(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) lease = await container.acquire_lease(lease_id='00000000-1111-2222-3333-444444444444') await lease.release() @@ -972,7 +972,7 @@ async def test_lease_container_with_duration(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) # Act @@ -990,7 +990,7 @@ async def test_lease_container_twice(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) # Act @@ -1006,7 +1006,7 @@ async def test_lease_container_with_proposed_lease_id(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) # Act @@ -1022,7 +1022,7 @@ async def test_lease_container_change_lease_id(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) # Act @@ -1045,7 +1045,7 @@ async def test_delete_container_with_existing_container(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) # Act @@ -1060,7 +1060,7 @@ async def test_delete_cntnr_w_nonexisting_cntnr_fail_not_exist(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container_name = self._get_container_reference() container = bsc.get_container_client(container_name) @@ -1078,7 +1078,7 @@ async def test_delete_container_with_lease_id(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) lease = await container.acquire_lease(lease_id='00000000-1111-2222-3333-444444444444', lease_duration=15) @@ -1098,7 +1098,7 @@ async def test_undelete_container(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # TODO: container soft delete should enabled by SRP call or use ARM, so make this test as playback only. - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container_client = await self._create_container(bsc) # Act @@ -1127,7 +1127,7 @@ async def test_list_names(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) data = b'hello world' @@ -1148,7 +1148,7 @@ async def test_list_blobs_returns_rehydrate_priority(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) data = b'hello world' @@ -1167,7 +1167,7 @@ async def test_list_blobs_cold_tier(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) data = b'hello world' @@ -1185,7 +1185,7 @@ async def test_list_blobs(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) data = b'hello world' cr0 = container.get_blob_client('blob1') @@ -1215,7 +1215,7 @@ async def test_list_blobs_with_object_replication_policy(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = bsc.get_container_client('orp-source') data = b'hello world' b_c = container.get_blob_client('blob3') @@ -1241,7 +1241,7 @@ async def test_list_blobs_leased_blob(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) data = b'hello world' blob1 = container.get_blob_client('blob1') @@ -1268,7 +1268,7 @@ async def test_list_blobs_with_prefix(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) data = b'hello world' c0 = container.get_blob_client('blob_a1') @@ -1295,7 +1295,7 @@ async def test_list_blobs_with_num_results(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) data = b'hello world' c0 = container.get_blob_client('blob_a1') @@ -1325,7 +1325,7 @@ async def test_list_blobs_with_include_snapshots(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) data = b'hello world' blob1 = container.get_blob_client('blob1') @@ -1353,7 +1353,7 @@ async def test_list_blobs_with_include_metadata(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) data = b'hello world' blob1 = container.get_blob_client('blob1') @@ -1382,7 +1382,7 @@ async def test_list_blobs_include_deletedwithversion(self, **kwargs): versioned_storage_account_name = kwargs.pop("versioned_storage_account_name") versioned_storage_account_key = kwargs.pop("versioned_storage_account_key") - bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key) + bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key.secret) container = await self._create_container(bsc) data = b'hello world' content_settings = ContentSettings( @@ -1425,7 +1425,7 @@ async def test_list_blobs_with_include_uncommittedblobs(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) data = b'hello world' blob1 = container.get_blob_client('blob1') @@ -1452,7 +1452,7 @@ async def test_list_blobs_with_include_copy(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) data = b'hello world' await (container.get_blob_client('blob1')).upload_blob(data, metadata={'status': 'original'}) @@ -1494,7 +1494,7 @@ async def test_list_blobs_with_delimiter(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) data = b'hello world' @@ -1525,7 +1525,7 @@ async def test_find_blobs_by_tags(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc, 'testfind') data = b'hello world' @@ -1576,7 +1576,7 @@ async def test_delete_blobs_simple(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) data = b'hello world' @@ -1605,7 +1605,7 @@ async def test_delete_blob_with_properties_versioning(self, **kwargs): versioned_storage_account_name = kwargs.pop("versioned_storage_account_name") versioned_storage_account_key = kwargs.pop("versioned_storage_account_key") - bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key) + bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key.secret) container: ContainerClient = await self._create_container(bsc) blob_name = self.get_resource_name("utcontainer") @@ -1637,13 +1637,13 @@ async def test_batch_blobs_with_container_sas(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container_name = self._get_container_reference("testcont") sas_token = self.generate_sas( generate_container_sas, storage_account_name, container_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, permission=ContainerSasPermissions(read=True, write=True, delete=True, list=True), expiry=datetime.utcnow() + timedelta(hours=1) ) @@ -1679,7 +1679,7 @@ async def test_delete_blobs_with_if_tags(self, **kwargs): blob_storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(blob_storage_account_name, "blob"), blob_storage_account_key) + bsc = BlobServiceClient(self.account_url(blob_storage_account_name, "blob"), blob_storage_account_key.secret) container = await self._create_container(bsc) data = b'hello world' tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} @@ -1729,7 +1729,7 @@ async def test_delete_blobs_and_snapshot_using_sas(self, **kwargs): sas_token = self.generate_sas( generate_account_sas, storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, resource_types=ResourceTypes(object=True, container=True), permission=AccountSasPermissions(read=True, write=True, delete=True, list=True), expiry=datetime.utcnow() + timedelta(hours=1) @@ -1784,7 +1784,7 @@ async def test_delete_blobs_simple_no_raise(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) data = b'hello world' @@ -1815,7 +1815,7 @@ async def test_delete_blobs_with_version_id(self, **kwargs): versioned_storage_account_key = kwargs.pop("versioned_storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key) + bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key.secret) container = await self._create_container(bsc) data = b'hello world' @@ -1856,7 +1856,7 @@ async def test_delete_blobs_with_properties_versioning(self, **kwargs): versioned_storage_account_name = kwargs.pop("versioned_storage_account_name") versioned_storage_account_key = kwargs.pop("versioned_storage_account_key") - bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key) + bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key.secret) container: ContainerClient = await self._create_container(bsc) blob_name = self.get_resource_name("utcontainer") @@ -1892,7 +1892,7 @@ async def test_delete_blobs_snapshot(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) data = b'hello world' @@ -1932,7 +1932,7 @@ async def test_standard_blob_tier_set_tier_api_batch(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) tiers = [StandardBlobTier.Archive, StandardBlobTier.Cool, StandardBlobTier.Hot] @@ -1981,7 +1981,7 @@ async def test_standard_blob_tier_with_if_tags(self, **kwargs): blob_storage_account_name = kwargs.pop("storage_account_name") blob_storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(blob_storage_account_name, "blob"), blob_storage_account_key) + bsc = BlobServiceClient(self.account_url(blob_storage_account_name, "blob"), blob_storage_account_key.secret) container = await self._create_container(bsc) tier = StandardBlobTier.Cool tags = {"tag1": "firsttag", "tag2": "secondtag", "tag3": "thirdtag"} @@ -2044,7 +2044,7 @@ async def test_standard_blob_tier_set_tiers_with_sas(self, **kwargs): sas_token = self.generate_sas( generate_account_sas, storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, resource_types=ResourceTypes(object=True, container=True), permission=AccountSasPermissions(read=True, write=True, delete=True, list=True), expiry=datetime.utcnow() + timedelta(hours=1) @@ -2100,7 +2100,7 @@ async def test_premium_tier_set_tier_api_batch(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key, transport=AiohttpTestTransport()) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret, transport=AiohttpTestTransport()) url = self._get_premium_account_url() credential = self._get_premium_shared_key_credential() pbs = BlobServiceClient(url, credential=credential) @@ -2156,7 +2156,7 @@ async def test_walk_blobs_with_delimiter(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) data = b'hello world' @@ -2190,7 +2190,7 @@ async def test_walk_blobs_with_prefix_delimiter_versions(self, **kwargs): versioned_storage_account_name = kwargs.pop("versioned_storage_account_name") versioned_storage_account_key = kwargs.pop("versioned_storage_account_key") - bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key) + bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key.secret) container = await self._create_container(bsc) data = b'hello world' @@ -2219,7 +2219,7 @@ async def test_walk_blobs_cold_tier(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) data = b'hello world' @@ -2239,7 +2239,7 @@ async def test_list_blobs_with_include_multiple(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) data = b'hello world' blob1 = container.get_blob_client('blob1') @@ -2276,7 +2276,7 @@ async def test_shared_access_container(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) blob_name = 'blob1' data = b'hello world' @@ -2307,7 +2307,7 @@ async def test_web_container_normal_operations_working(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret) # create the web container in case it does not exist yet container = bsc.get_container_client(web_container) @@ -2343,7 +2343,7 @@ async def test_download_blob(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) data = b'hello world' blob_name = self.get_resource_name("blob") @@ -2362,7 +2362,7 @@ async def test_download_blob_with_properties_versioning(self, **kwargs): versioned_storage_account_name = kwargs.pop("versioned_storage_account_name") versioned_storage_account_key = kwargs.pop("versioned_storage_account_key") - bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key) + bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key.secret) container: ContainerClient = await self._create_container(bsc) blob_name = self.get_resource_name("utcontainer") @@ -2390,7 +2390,7 @@ async def test_download_blob_in_chunks_where_maxsinglegetsize_is_multiple_of_chu storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key, + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret, max_single_get_size=1024, max_chunk_get_size=512) container = await self._create_container(bsc) @@ -2419,7 +2419,7 @@ async def test_download_blob_in_chunks_where_maxsinglegetsize_not_multiple_of_ch storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key, + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret, max_single_get_size=1024, max_chunk_get_size=666) container = await self._create_container(bsc) @@ -2448,7 +2448,7 @@ async def test_download_blob_in_chunks_where_maxsinglegetsize_smallert_than_chun storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key, + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret, max_single_get_size=215, max_chunk_get_size=512) container = await self._create_container(bsc) @@ -2477,7 +2477,7 @@ async def test_list_blob_names(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container: ContainerClient = await self._create_container(bsc) data = b'hello world' @@ -2508,7 +2508,7 @@ async def test_list_blob_names_pagination(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container: ContainerClient = await self._create_container(bsc) data = b'hello world' @@ -2538,7 +2538,7 @@ async def test_get_blob_client_with_properties_versioning(self, **kwargs): versioned_storage_account_name = kwargs.pop("versioned_storage_account_name") versioned_storage_account_key = kwargs.pop("versioned_storage_account_key") - bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key) + bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), versioned_storage_account_key.secret) container: ContainerClient = await self._create_container(bsc) blob_name = self.get_resource_name("utcontainer") @@ -2579,7 +2579,7 @@ async def test_storage_account_audience_container_client(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - cc = ContainerClient(self.account_url(storage_account_name, "blob"), 'testcont', storage_account_key) + cc = ContainerClient(self.account_url(storage_account_name, "blob"), 'testcont', storage_account_key.secret) await cc.exists() # Act @@ -2628,7 +2628,7 @@ async def test_list_blobs_start_end(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) data = b'hello world' await (container.get_blob_client('blob1')).upload_blob(data) @@ -2651,7 +2651,7 @@ async def test_walk_blobs_start_end(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) container = await self._create_container(bsc) data = b'hello world' await (container.get_blob_client('a/blob1')).upload_blob(data) diff --git a/sdk/storage/azure-storage-blob/tests/test_cpk.py b/sdk/storage/azure-storage-blob/tests/test_cpk.py index 9f7f2e9485b3..fea8c358689c 100644 --- a/sdk/storage/azure-storage-blob/tests/test_cpk.py +++ b/sdk/storage/azure-storage-blob/tests/test_cpk.py @@ -84,7 +84,7 @@ def test_put_block_and_put_block_list(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, connection_data_block_size=1024, max_single_put_size=1024, min_large_block_upload_threshold=1024, @@ -129,7 +129,7 @@ def test_create_block_blob_with_chunks(self, **kwargs): bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, connection_data_block_size=1024, max_single_put_size=1024, min_large_block_upload_threshold=1024, @@ -173,7 +173,7 @@ def test_create_block_blob_with_sub_streams(self, **kwargs): bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, connection_data_block_size=1024, max_single_put_size=1024, min_large_block_upload_threshold=1024, @@ -215,7 +215,7 @@ def test_create_block_blob_with_single_chunk(self, **kwargs): # Act bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, connection_data_block_size=1024, max_single_put_size=1024, min_large_block_upload_threshold=1024, @@ -255,7 +255,7 @@ def test_put_block_from_url_and_commit_with_cpk(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, connection_data_block_size=1024, max_single_put_size=1024, min_large_block_upload_threshold=1024, @@ -329,7 +329,7 @@ def test_append_block(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, connection_data_block_size=1024, max_single_put_size=1024, min_large_block_upload_threshold=1024, @@ -368,7 +368,7 @@ def test_append_block_from_url(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, connection_data_block_size=1024, max_single_put_size=1024, min_large_block_upload_threshold=1024, @@ -427,7 +427,7 @@ def test_create_append_blob_with_chunks(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, connection_data_block_size=1024, max_single_put_size=1024, min_large_block_upload_threshold=1024, @@ -467,7 +467,7 @@ def test_update_page(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, connection_data_block_size=1024, max_single_put_size=1024, min_large_block_upload_threshold=1024, @@ -511,7 +511,7 @@ def test_update_page_from_url(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, connection_data_block_size=1024, max_single_put_size=1024, min_large_block_upload_threshold=1024, @@ -573,7 +573,7 @@ def test_create_page_blob_with_chunks(self, **kwargs): # Act bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, connection_data_block_size=1024, max_single_put_size=1024, min_large_block_upload_threshold=1024, @@ -615,7 +615,7 @@ def test_get_set_blob_metadata(self, **kwargs): # otherwise the tests would take too long to execute bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, connection_data_block_size=1024, max_single_put_size=1024, min_large_block_upload_threshold=1024, @@ -665,7 +665,7 @@ def test_snapshot_blob(self, **kwargs): # otherwise the tests would take too long to execute bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, connection_data_block_size=1024, max_single_put_size=1024, min_large_block_upload_threshold=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 14610b6beb25..f5cd9ece8ed8 100644 --- a/sdk/storage/azure-storage-blob/tests/test_cpk_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_cpk_async.py @@ -83,7 +83,7 @@ async def test_put_block_and_put_block_list(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - storage_account_key, + storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -128,7 +128,7 @@ async def test_create_block_blob_with_chunks(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - storage_account_key, + storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -171,7 +171,7 @@ async def test_create_block_blob_with_sub_streams(self, **kwargs): # create_blob_from_bytes forces the in-memory chunks to be used bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - storage_account_key, + storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -212,7 +212,7 @@ async def test_create_block_blob_with_single_chunk(self, **kwargs): # Act bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - storage_account_key, + storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -250,7 +250,7 @@ async def test_put_block_from_url_and_commit(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - storage_account_key, + storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -323,7 +323,7 @@ async def test_append_block(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - storage_account_key, + storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -361,7 +361,7 @@ async def test_append_block_from_url(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - storage_account_key, + storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -418,7 +418,7 @@ async def test_create_append_blob_with_chunks(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - storage_account_key, + storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -456,7 +456,7 @@ async def test_update_page(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - storage_account_key, + storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -498,7 +498,7 @@ async def test_update_page_from_url(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - storage_account_key, + storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -557,7 +557,7 @@ async def test_create_page_blob_with_chunks(self, **kwargs): bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - storage_account_key, + storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -597,7 +597,7 @@ async def test_get_set_blob_metadata(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - storage_account_key, + storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -643,7 +643,7 @@ async def test_snapshot_blob(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - storage_account_key, + storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, diff --git a/sdk/storage/azure-storage-blob/tests/test_cpk_n.py b/sdk/storage/azure-storage-blob/tests/test_cpk_n.py index 022b19707487..a6e8dd82407a 100644 --- a/sdk/storage/azure-storage-blob/tests/test_cpk_n.py +++ b/sdk/storage/azure-storage-blob/tests/test_cpk_n.py @@ -98,7 +98,7 @@ def test_put_block_and_put_block_list(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -138,7 +138,7 @@ def test_put_block_and_put_block_list_with_blob_sas(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -151,7 +151,7 @@ def test_put_block_and_put_block_list_with_blob_sas(self, **kwargs): storage_account_name, self.container_name, blob_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, permission=BlobSasPermissions(read=True, write=True, delete=True), expiry=datetime.utcnow() + timedelta(hours=1), encryption_scope=TEST_ENCRYPTION_SCOPE, @@ -192,7 +192,7 @@ def test_put_block_and_put_block_list_with_blob_sas_fails(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -205,7 +205,7 @@ def test_put_block_and_put_block_list_with_blob_sas_fails(self, **kwargs): storage_account_name, self.container_name, blob_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, permission=BlobSasPermissions(read=True, write=True, delete=True), expiry=datetime.utcnow() + timedelta(hours=1), encryption_scope=TEST_ENCRYPTION_SCOPE, @@ -241,7 +241,7 @@ def test_put_block_and_put_block_list_with_blob_sas_fails(self, **kwargs): storage_account_name, self.container_name, blob_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, permission=BlobSasPermissions(read=True, write=True, delete=True), expiry=datetime.utcnow() + timedelta(hours=1), encryption_scope=TEST_ENCRYPTION_SCOPE_2, @@ -270,7 +270,7 @@ def test_create_block_blob_with_chunks(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -311,7 +311,7 @@ def test_create_block_blob_with_sub_streams(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -350,7 +350,7 @@ def test_create_block_blob_with_single_chunk(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -386,7 +386,7 @@ def test_put_block_from_url_and_commit_with_cpk(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -458,7 +458,7 @@ def test_append_block(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -492,7 +492,7 @@ def test_append_block_from_url(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -545,7 +545,7 @@ def test_create_append_blob_with_chunks(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -580,7 +580,7 @@ def test_update_page(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -618,7 +618,7 @@ def test_update_page_from_url(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -675,7 +675,7 @@ def test_create_page_blob_with_chunks(self, **kwargs): # otherwise the tests would take too long to execute bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -710,7 +710,7 @@ def test_get_set_blob_metadata(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -753,7 +753,7 @@ def test_snapshot_blob(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -781,7 +781,7 @@ def test_list_blobs(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -809,7 +809,7 @@ def test_list_blobs_using_container_encryption_scope_sas(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -820,7 +820,7 @@ def test_list_blobs_using_container_encryption_scope_sas(self, **kwargs): generate_container_sas, storage_account_name, self.container_name, - storage_account_key, + storage_account_key.secret, permission=ContainerSasPermissions(read=True, write=True, list=True, delete=True), expiry=datetime.utcnow() + timedelta(hours=1), encryption_scope=TEST_ENCRYPTION_SCOPE @@ -841,7 +841,7 @@ def test_list_blobs_using_container_encryption_scope_sas(self, **kwargs): generate_container_sas, storage_account_name, self.container_name, - storage_account_key, + storage_account_key.secret, permission=ContainerSasPermissions(read=True, write=True, list=True, delete=True), expiry=datetime.utcnow() + timedelta(hours=1), encryption_scope=TEST_ENCRYPTION_SCOPE_2 @@ -876,7 +876,7 @@ def test_copy_with_account_encryption_scope_sas(self, **kwargs): sas_token = self.generate_sas( generate_account_sas, storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, resource_types=ResourceTypes(object=True, container=True), permission=AccountSasPermissions(read=True, write=True, delete=True, list=True), expiry=datetime.utcnow() + timedelta(hours=1), @@ -897,7 +897,7 @@ def test_copy_with_account_encryption_scope_sas(self, **kwargs): sas_token2 = self.generate_sas( generate_account_sas, storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, resource_types=ResourceTypes(object=True, container=True), permission=AccountSasPermissions(read=True, write=True, delete=True, list=True), expiry=datetime.utcnow() + timedelta(hours=1), @@ -933,7 +933,7 @@ def test_copy_blob_from_url_with_ecryption_scope(self, **kwargs): sas_token = self.generate_sas( generate_account_sas, storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, resource_types=ResourceTypes(object=True, container=True), permission=AccountSasPermissions(read=True, write=True, delete=True, list=True), expiry=datetime.utcnow() + timedelta(hours=1), @@ -951,7 +951,7 @@ def test_copy_blob_from_url_with_ecryption_scope(self, **kwargs): bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -1025,7 +1025,7 @@ def test_create_container_with_default_cpk_n(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -1060,7 +1060,7 @@ def test_create_container_with_default_cpk_n_deny_override(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, diff --git a/sdk/storage/azure-storage-blob/tests/test_cpk_n_async.py b/sdk/storage/azure-storage-blob/tests/test_cpk_n_async.py index d2a26d6795df..5dc8e56746b0 100644 --- a/sdk/storage/azure-storage-blob/tests/test_cpk_n_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_cpk_n_async.py @@ -97,7 +97,7 @@ async def test_put_block_and_put_block_list(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - storage_account_key, + storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -138,7 +138,7 @@ async def test_put_block_and_put_block_list_with_blob_sas(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -151,7 +151,7 @@ async def test_put_block_and_put_block_list_with_blob_sas(self, **kwargs): storage_account_name, self.container_name, blob_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, permission=BlobSasPermissions(read=True, write=True, delete=True), expiry=datetime.utcnow() + timedelta(hours=1), encryption_scope=TEST_ENCRYPTION_SCOPE, @@ -193,7 +193,7 @@ async def test_put_block_and_put_block_list_with_blob_sas_fails(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -206,7 +206,7 @@ async def test_put_block_and_put_block_list_with_blob_sas_fails(self, **kwargs): storage_account_name, self.container_name, blob_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, permission=BlobSasPermissions(read=True, write=True, delete=True), expiry=datetime.utcnow() + timedelta(hours=1), encryption_scope=TEST_ENCRYPTION_SCOPE, @@ -242,7 +242,7 @@ async def test_put_block_and_put_block_list_with_blob_sas_fails(self, **kwargs): storage_account_name, self.container_name, blob_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, permission=BlobSasPermissions(read=True, write=True, delete=True), expiry=datetime.utcnow() + timedelta(hours=1), encryption_scope=TEST_ENCRYPTION_SCOPE_2, @@ -272,7 +272,7 @@ async def test_create_block_blob_with_chunks(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - storage_account_key, + storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -314,7 +314,7 @@ async def test_create_block_blob_with_sub_streams(self, **kwargs): # create_blob_from_bytes forces the in-memory chunks to be used bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - storage_account_key, + storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -354,7 +354,7 @@ async def test_create_block_blob_with_single_chunk(self, **kwargs): # Act bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - storage_account_key, + storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -388,7 +388,7 @@ async def test_put_block_from_url_and_commit(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - storage_account_key, + storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -460,7 +460,7 @@ async def test_append_block(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - storage_account_key, + storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -494,7 +494,7 @@ async def test_append_block_from_url(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - storage_account_key, + storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -547,7 +547,7 @@ async def test_create_append_blob_with_chunks(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - storage_account_key, + storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -581,7 +581,7 @@ async def test_update_page(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - storage_account_key, + storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -617,7 +617,7 @@ async def test_update_page_from_url(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - storage_account_key, + storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -670,7 +670,7 @@ async def test_create_page_blob_with_chunks(self, **kwargs): bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - storage_account_key, + storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -706,7 +706,7 @@ async def test_get_set_blob_metadata(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - storage_account_key, + storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -748,7 +748,7 @@ async def test_snapshot_blob(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - storage_account_key, + storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -775,7 +775,7 @@ async def test_list_blobs(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -803,7 +803,7 @@ async def test_list_blobs_using_container_encryption_scope_sas(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -814,7 +814,7 @@ async def test_list_blobs_using_container_encryption_scope_sas(self, **kwargs): generate_container_sas, storage_account_name, self.container_name, - storage_account_key, + storage_account_key.secret, permission=ContainerSasPermissions(read=True, write=True, list=True, delete=True), expiry=datetime.utcnow() + timedelta(hours=1), encryption_scope=TEST_ENCRYPTION_SCOPE @@ -835,7 +835,7 @@ async def test_list_blobs_using_container_encryption_scope_sas(self, **kwargs): generate_container_sas, storage_account_name, self.container_name, - storage_account_key, + storage_account_key.secret, permission=ContainerSasPermissions(read=True, write=True, list=True, delete=True), expiry=datetime.utcnow() + timedelta(hours=1), encryption_scope=TEST_ENCRYPTION_SCOPE_2 @@ -870,7 +870,7 @@ async def test_copy_with_account_encryption_scope_sas(self, **kwargs): sas_token = self.generate_sas( generate_account_sas, storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, resource_types=ResourceTypes(object=True, container=True), permission=AccountSasPermissions(read=True, write=True, delete=True, list=True), expiry=datetime.utcnow() + timedelta(hours=1), @@ -891,7 +891,7 @@ async def test_copy_with_account_encryption_scope_sas(self, **kwargs): sas_token2 = self.generate_sas( generate_account_sas, storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, resource_types=ResourceTypes(object=True, container=True), permission=AccountSasPermissions(read=True, write=True, delete=True, list=True), expiry=datetime.utcnow() + timedelta(hours=1), @@ -929,7 +929,7 @@ async def test_copy_blob_from_url_with_ecryption_scope(self, **kwargs): sas_token = self.generate_sas( generate_account_sas, storage_account_name, - account_key=storage_account_key, + account_key=storage_account_key.secret, resource_types=ResourceTypes(object=True, container=True), permission=AccountSasPermissions(read=True, write=True, delete=True, list=True), expiry=datetime.utcnow() + timedelta(hours=1), @@ -947,7 +947,7 @@ async def test_copy_blob_from_url_with_ecryption_scope(self, **kwargs): bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -1022,7 +1022,7 @@ async def test_create_container_with_default_cpk_n(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=1024, @@ -1059,7 +1059,7 @@ async def test_create_container_with_default_cpk_n_deny_override(self, **kwargs) # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, min_large_block_upload_threshold=1024, max_block_size=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 721a68661181..396dd7238079 100644 --- a/sdk/storage/azure-storage-blob/tests/test_get_blob.py +++ b/sdk/storage/azure-storage-blob/tests/test_get_blob.py @@ -30,7 +30,7 @@ def _setup(self, storage_account_name, key, upload_blob=True): # the tests would take too long to execute self.bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=key, + credential=key.secret, max_single_get_size=1024, max_chunk_get_size=1024) self.config = self.bsc._config 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 fb212f6c8acd..a253f6d34567 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 @@ -30,7 +30,7 @@ class TestStorageGetBlobTest(AsyncStorageRecordedTestCase): async def _setup(self, storage_account_name, key, upload_blob=True): self.bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=key, + credential=key.secret, max_single_get_size=32 * 1024, max_chunk_get_size=4 * 1024) self.config = self.bsc._config @@ -1039,7 +1039,7 @@ async def test_get_blob_progress_single_get(self, **kwargs): self.account_url(storage_account_name, 'blob'), self.container_name, blob_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=1024, max_chunk_get_size=1024) @@ -1067,7 +1067,7 @@ async def test_get_blob_progress_chunked(self, **kwargs): self.account_url(storage_account_name, 'blob'), self.container_name, blob_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=1024, max_chunk_get_size=1024) @@ -1096,7 +1096,7 @@ async def test_get_blob_progress_chunked_parallel(self, **kwargs): self.account_url(storage_account_name, 'blob'), self.container_name, blob_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=1024, max_chunk_get_size=1024) @@ -1125,7 +1125,7 @@ async def test_get_blob_progress_range(self, **kwargs): self.account_url(storage_account_name, 'blob'), self.container_name, blob_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=1024, max_chunk_get_size=1024) @@ -1159,7 +1159,7 @@ async def test_get_blob_progress_readinto(self, **kwargs): self.account_url(storage_account_name, 'blob'), self.container_name, blob_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=1024, max_chunk_get_size=1024) 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 49f0c31960cb..152b22d84d35 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 @@ -33,7 +33,7 @@ def _setup(self, storage_account_name, key): # the tests would take too long to execute self.bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=key, + credential=key.secret, max_single_put_size=32 * 1024, max_block_size=2 * 1024 * 1024, min_large_block_upload_threshold=1 * 1024 * 1024) 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 93e8452d9612..680fc3539cfa 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 @@ -32,7 +32,7 @@ async def _setup(self, storage_account_name, key): # the tests would take too long to execute self.bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=key, + credential=key.secret, max_single_put_size=32 * 1024, max_block_size=2 * 1024 * 1024, min_large_block_upload_threshold=1 * 1024 * 1024) diff --git a/sdk/storage/azure-storage-blob/tests/test_largest_block_blob.py b/sdk/storage/azure-storage-blob/tests/test_largest_block_blob.py index b632d76e9fd8..3f209ebf7c1d 100644 --- a/sdk/storage/azure-storage-blob/tests/test_largest_block_blob.py +++ b/sdk/storage/azure-storage-blob/tests/test_largest_block_blob.py @@ -39,7 +39,7 @@ def _setup( ): self.bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=key, + credential=key.secret, max_single_put_size=max_single_put_size, max_block_size=LARGEST_BLOCK_SIZE, min_large_block_upload_threshold=min_large_block_upload_threshold, @@ -100,7 +100,7 @@ def test_put_block_bytes_largest_without_network(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") payload_dropping_policy = PayloadDroppingPolicy() - credential_policy = _format_shared_key_credential(storage_account_name, storage_account_key) + credential_policy = _format_shared_key_credential(storage_account_name, storage_account_key.secret) self._setup(storage_account_name, storage_account_key, [payload_dropping_policy, credential_policy]) blob = self._create_blob() @@ -166,7 +166,7 @@ def test_put_block_stream_largest_without_network(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") payload_dropping_policy = PayloadDroppingPolicy() - credential_policy = _format_shared_key_credential(storage_account_name, storage_account_key) + credential_policy = _format_shared_key_credential(storage_account_name, storage_account_key.secret) self._setup(storage_account_name, storage_account_key, [payload_dropping_policy, credential_policy]) blob = self._create_blob() @@ -246,7 +246,7 @@ def test_create_largest_blob_from_path_without_network(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") payload_dropping_policy = PayloadDroppingPolicy() - credential_policy = _format_shared_key_credential(storage_account_name, storage_account_key) + credential_policy = _format_shared_key_credential(storage_account_name, storage_account_key.secret) self._setup(storage_account_name, storage_account_key, [payload_dropping_policy, credential_policy]) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -273,7 +273,7 @@ def test_create_largest_blob_from_stream_without_network(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") payload_dropping_policy = PayloadDroppingPolicy() - credential_policy = _format_shared_key_credential(storage_account_name, storage_account_key) + credential_policy = _format_shared_key_credential(storage_account_name, storage_account_key.secret) self._setup(storage_account_name, storage_account_key, [payload_dropping_policy, credential_policy]) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -296,7 +296,7 @@ def test_create_largest_blob_from_stream_single_upload_without_network(self, **k storage_account_key = kwargs.pop("storage_account_key") payload_dropping_policy = PayloadDroppingPolicy() - credential_policy = _format_shared_key_credential(storage_account_name, storage_account_key) + credential_policy = _format_shared_key_credential(storage_account_name, storage_account_key.secret) self._setup(storage_account_name, storage_account_key, [payload_dropping_policy, credential_policy], max_single_put_size=LARGEST_SINGLE_UPLOAD_SIZE+1) blob_name = self._get_blob_reference() diff --git a/sdk/storage/azure-storage-blob/tests/test_largest_block_blob_async.py b/sdk/storage/azure-storage-blob/tests/test_largest_block_blob_async.py index 104ee894a2c6..4cc3634c3d71 100644 --- a/sdk/storage/azure-storage-blob/tests/test_largest_block_blob_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_largest_block_blob_async.py @@ -40,7 +40,7 @@ async def _setup( ): self.bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=key, + credential=key.secret, max_single_put_size=max_single_put_size, max_block_size=LARGEST_BLOCK_SIZE, min_large_block_upload_threshold=min_large_block_upload_threshold, @@ -102,7 +102,7 @@ async def test_put_block_bytes_largest_without_network(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") payload_dropping_policy = PayloadDroppingPolicy() - credential_policy = _format_shared_key_credential(storage_account_name, storage_account_key) + credential_policy = _format_shared_key_credential(storage_account_name, storage_account_key.secret) await self._setup(storage_account_name, storage_account_key, [payload_dropping_policy, credential_policy]) blob = await self._create_blob() @@ -168,7 +168,7 @@ async def test_put_block_stream_largest_without_network(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") payload_dropping_policy = PayloadDroppingPolicy() - credential_policy = _format_shared_key_credential(storage_account_name, storage_account_key) + credential_policy = _format_shared_key_credential(storage_account_name, storage_account_key.secret) await self._setup(storage_account_name, storage_account_key, [payload_dropping_policy, credential_policy]) blob = await self._create_blob() @@ -224,7 +224,7 @@ async def test_create_largest_blob_from_path_without_network(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") payload_dropping_policy = PayloadDroppingPolicy() - credential_policy = _format_shared_key_credential(storage_account_name, storage_account_key) + credential_policy = _format_shared_key_credential(storage_account_name, storage_account_key.secret) await self._setup(storage_account_name, storage_account_key, [payload_dropping_policy, credential_policy]) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -251,7 +251,7 @@ async def test_create_largest_blob_from_stream_without_network(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") payload_dropping_policy = PayloadDroppingPolicy() - credential_policy = _format_shared_key_credential(storage_account_name, storage_account_key) + credential_policy = _format_shared_key_credential(storage_account_name, storage_account_key.secret) await self._setup(storage_account_name, storage_account_key, [payload_dropping_policy, credential_policy]) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) @@ -274,7 +274,7 @@ async def test_create_largest_blob_from_stream_single_upload_without_network(sel storage_account_key = kwargs.pop("storage_account_key") payload_dropping_policy = PayloadDroppingPolicy() - credential_policy = _format_shared_key_credential(storage_account_name, storage_account_key) + credential_policy = _format_shared_key_credential(storage_account_name, storage_account_key.secret) await self._setup(storage_account_name, storage_account_key, [payload_dropping_policy, credential_policy], max_single_put_size=LARGEST_SINGLE_UPLOAD_SIZE + 1) blob_name = self._get_blob_reference() diff --git a/sdk/storage/azure-storage-blob/tests/test_logging.py b/sdk/storage/azure-storage-blob/tests/test_logging.py index 52e1d517b117..6667951cdefa 100644 --- a/sdk/storage/azure-storage-blob/tests/test_logging.py +++ b/sdk/storage/azure-storage-blob/tests/test_logging.py @@ -68,7 +68,7 @@ def test_logging_request_and_response_body(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key, logging_enable=True) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret, logging_enable=True) self._setup(bsc) container = bsc.get_container_client(self.container_name) request_body = 'testloggingbody' @@ -94,7 +94,7 @@ def test_authorization_is_scrubbed_off(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) self._setup(bsc) container = bsc.get_container_client(self.container_name) # Act @@ -114,7 +114,7 @@ def test_sas_signature_is_scrubbed_off(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret) self._setup(bsc) # Arrange container = bsc.get_container_client(self.container_name) @@ -149,7 +149,7 @@ def test_copy_source_sas_is_scrubbed_off(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret) 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 b7c48bf72c8a..963b73ea9530 100644 --- a/sdk/storage/azure-storage-blob/tests/test_logging_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_logging_async.py @@ -62,7 +62,7 @@ async def test_logging_request_and_response_body(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key, logging_enable=True) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret, logging_enable=True) await self._setup(bsc) # Arrange container = bsc.get_container_client(self.container_name) @@ -88,7 +88,7 @@ async def test_authorization_is_scrubbed_off(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) await self._setup(bsc) # Arrange container = bsc.get_container_client(self.container_name) @@ -110,7 +110,7 @@ async def test_sas_signature_is_scrubbed_off(self, **kwargs): # Test can only run live - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) await self._setup(bsc) # Arrange container = bsc.get_container_client(self.container_name) @@ -145,7 +145,7 @@ async def test_copy_source_sas_is_scrubbed_off(self, **kwargs): storage_account_key = kwargs.pop("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_name, "blob"), storage_account_key.secret) await self._setup(bsc) # Arrange dest_blob_name = self.get_resource_name('destblob') diff --git a/sdk/storage/azure-storage-blob/tests/test_ors.py b/sdk/storage/azure-storage-blob/tests/test_ors.py index 0a7075fdb0ba..ccdd2e426dcd 100644 --- a/sdk/storage/azure-storage-blob/tests/test_ors.py +++ b/sdk/storage/azure-storage-blob/tests/test_ors.py @@ -54,7 +54,7 @@ def test_ors_source(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key) + credential=storage_account_key.secret) blob = bsc.get_blob_client(container=self.SRC_CONTAINER, blob=self.BLOB_NAME) # Act @@ -86,7 +86,7 @@ def test_ors_destination(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key) + credential=storage_account_key.secret) blob = bsc.get_blob_client(container=self.DST_CONTAINER, blob=self.BLOB_NAME) # Act diff --git a/sdk/storage/azure-storage-blob/tests/test_ors_async.py b/sdk/storage/azure-storage-blob/tests/test_ors_async.py index a1474398534d..2b6ad63a6f0b 100644 --- a/sdk/storage/azure-storage-blob/tests/test_ors_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_ors_async.py @@ -35,7 +35,7 @@ async def test_ors_source(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, ) blob = bsc.get_blob_client(container=self.SRC_CONTAINER, blob=self.BLOB_NAME) @@ -68,7 +68,7 @@ async def test_ors_destination(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key, + credential=storage_account_key.secret, ) blob = bsc.get_blob_client(container=self.DST_CONTAINER, blob=self.BLOB_NAME) 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 19bb1642f8ca..84ce296f2484 100644 --- a/sdk/storage/azure-storage-blob/tests/test_page_blob.py +++ b/sdk/storage/azure-storage-blob/tests/test_page_blob.py @@ -119,7 +119,7 @@ def test_create_blob(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) @@ -139,7 +139,7 @@ def test_create_blob_with_immutability_policy(self, **kwargs): storage_resource_group_name = kwargs.pop("storage_resource_group_name") variables = kwargs.pop("variables", {}) - bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), credential=versioned_storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), credential=versioned_storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) container_name = self.get_resource_name('vlwcontainer') @@ -183,7 +183,7 @@ def test_create_page_blob_returns_vid(self, **kwargs): versioned_storage_account_name = kwargs.pop("versioned_storage_account_name") versioned_storage_account_key = kwargs.pop("versioned_storage_account_key") - bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), credential=versioned_storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), credential=versioned_storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) @@ -202,7 +202,7 @@ def test_create_blob_with_metadata(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) metadata = {'hello': 'world', 'number': '42'} @@ -220,7 +220,7 @@ def test_put_page_with_lease_id(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) lease = blob.acquire_lease(lease_id='00000000-1111-2222-3333-444444444444') @@ -239,7 +239,7 @@ def test_put_page_with_lease_id_and_if_tags(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) tags = {"tag1 name": "my tag", "tag2": "secondtag", "tag3": "thirdtag"} blob = self._create_blob(bsc, tags=tags) @@ -266,7 +266,7 @@ def test_update_page(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) @@ -286,7 +286,7 @@ def test_create_8tb_blob(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) @@ -308,7 +308,7 @@ def test_create_larger_than_8tb_blob_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) @@ -322,7 +322,7 @@ def test_update_8tb_blob_page(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) blob.create_page_blob(EIGHT_TB) @@ -351,7 +351,7 @@ def test_update_page_with_md5(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) @@ -367,7 +367,7 @@ def test_clear_page(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) @@ -386,7 +386,7 @@ def test_put_page_if_sequence_number_lt_success(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(512) @@ -406,7 +406,7 @@ def test_update_page_if_sequence_number_lt_failure(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(512) @@ -425,7 +425,7 @@ def test_update_page_if_sequence_number_lte_success(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(512) @@ -444,7 +444,7 @@ def test_update_page_if_sequence_number_lte_failure(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(512) @@ -463,7 +463,7 @@ def test_update_page_if_sequence_number_eq_success(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(512) @@ -482,7 +482,7 @@ def test_update_page_if_sequence_number_eq_failure(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(512) @@ -499,7 +499,7 @@ def test_update_page_unicode(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) @@ -517,7 +517,7 @@ def test_upload_pages_from_url(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, 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) @@ -584,7 +584,7 @@ def test_upload_pages_from_url_with_oauth(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) token = "Bearer {}".format(self.get_credential(BlobServiceClient).get_token("https://storage.azure.com/.default").token) source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) @@ -608,7 +608,7 @@ def test_upload_pages_from_url_and_validate_content_md5(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, 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) @@ -656,7 +656,7 @@ def test_upload_pages_from_url_with_source_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, 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) @@ -706,7 +706,7 @@ def test_upload_pages_from_url_with_source_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, 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) @@ -755,7 +755,7 @@ def test_upload_pages_from_url_with_source_if_match(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, 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) @@ -805,7 +805,7 @@ def test_upload_pages_from_url_with_source_if_none_match(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, 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) @@ -855,7 +855,7 @@ def test_upload_pages_from_url_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, 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) @@ -904,7 +904,7 @@ def test_upload_pages_from_url_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, 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) @@ -954,7 +954,7 @@ def test_upload_pages_from_url_with_if_match(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, 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) @@ -999,7 +999,7 @@ def test_upload_pages_from_url_with_if_none_match(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, 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) @@ -1049,7 +1049,7 @@ def test_upload_pages_from_url_with_sequence_number_lt(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) start_sequence = 10 source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) @@ -1097,7 +1097,7 @@ def test_upload_pages_from_url_with_sequence_number_lte(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) start_sequence = 10 source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) @@ -1145,7 +1145,7 @@ def test_upload_pages_from_url_with_sequence_number_eq(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) start_sequence = 10 source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) @@ -1192,7 +1192,7 @@ def test_list_page_ranges(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) self._setup(bsc) blob = self._create_blob(bsc, length=2560) data = self.get_random_bytes(512) @@ -1218,7 +1218,7 @@ def test_list_page_ranges_pagination(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) self._setup(bsc) blob = self._create_blob(bsc, length=3072) data = self.get_random_bytes(512) @@ -1243,7 +1243,7 @@ def test_list_page_ranges_empty(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) self._setup(bsc) blob = self._create_blob(bsc, length=2560) @@ -1261,7 +1261,7 @@ def test_list_page_ranges_offset(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) self._setup(bsc) blob = self._create_blob(bsc, length=2560) data = self.get_random_bytes(512) @@ -1289,7 +1289,7 @@ def test_list_page_ranges_diff(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) self._setup(bsc) blob = self._create_blob(bsc, length=2048) data = self.get_random_bytes(1536) @@ -1329,7 +1329,7 @@ def test_list_page_ranges_diff_pagination(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) self._setup(bsc) blob = self._create_blob(bsc, length=2048) data = self.get_random_bytes(1536) @@ -1354,7 +1354,7 @@ def test_get_page_ranges_no_pages(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) @@ -1372,7 +1372,7 @@ def test_get_page_ranges_2_pages(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc, length=2048) data = self.get_random_bytes(512) @@ -1397,7 +1397,7 @@ def test_get_page_ranges_diff(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc, length=2048) data = self.get_random_bytes(1536) @@ -1441,7 +1441,7 @@ def test_get_page_range_diff_for_managed_disk(self, **kwargs): # A Managed Disk account is required to run this test live. # Change this URL as needed. (e.g. partitioned DNS, preprod, etc.) account_url = f"https://{storage_account_name}.blob.core.windows.net/" - credential = {"account_name": storage_account_name, "account_key": storage_account_key} + credential = {"account_name": storage_account_name, "account_key": storage_account_key.secret} bsc = BlobServiceClient(account_url, credential=credential, max_page_size=4 * 1024) self._setup(bsc) @@ -1508,7 +1508,7 @@ def test_update_page_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc, length=2048) data = self.get_random_bytes(512) @@ -1524,7 +1524,7 @@ def test_resize_blob(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc, length=1024) @@ -1545,7 +1545,7 @@ def test_set_sequence_number_blob(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._create_blob(bsc) @@ -1566,7 +1566,7 @@ def test_create_page_blob_with_no_overwrite(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data1 = b'1234' * 128 @@ -1602,7 +1602,7 @@ def test_create_page_blob_with_overwrite(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data1 = b'1234' * 128 @@ -1636,7 +1636,7 @@ def test_create_blob_from_bytes(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1656,7 +1656,7 @@ def test_create_blob_from_0_bytes(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(0) @@ -1676,7 +1676,7 @@ def test_create_blob_from_bytes_with_progress_first(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1705,7 +1705,7 @@ def test_create_blob_from_bytes_with_index(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1723,7 +1723,7 @@ def test_create_blob_from_bytes_with_index_and_count(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1745,7 +1745,7 @@ def test_create_blob_from_path(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1768,7 +1768,7 @@ def test_create_blob_from_path_with_progress(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1796,7 +1796,7 @@ def test_create_blob_from_stream(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1820,7 +1820,7 @@ def test_create_blob_from_stream_with_empty_pages(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) # data is almost all empty (0s) except two ranges blob = self._get_blob_reference(bsc) @@ -1854,7 +1854,7 @@ def test_create_blob_from_stream_non_seekable(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1876,7 +1876,7 @@ def test_create_blob_from_stream_with_progress(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1905,7 +1905,7 @@ def test_create_blob_from_stream_truncated(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1926,7 +1926,7 @@ def test_create_blob_from_stream_with_progress_truncated(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1955,7 +1955,7 @@ def test_create_blob_with_md5_small(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(512) @@ -1971,7 +1971,7 @@ def test_create_blob_with_md5_large(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1987,7 +1987,7 @@ def test_incremental_copy_blob(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) try: @@ -2033,11 +2033,10 @@ def test_blob_tier_on_create(self, **kwargs): premium_storage_account_name = kwargs.pop("premium_storage_account_name") premium_storage_account_key = kwargs.pop("premium_storage_account_key") - bsc = BlobServiceClient(self.account_url(premium_storage_account_name, "blob"), credential=premium_storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(premium_storage_account_name, "blob"), credential=premium_storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) url = self.account_url(premium_storage_account_name, "blob") - credential = premium_storage_account_key - pbs = BlobServiceClient(url, credential=credential) + pbs = BlobServiceClient(url, credential=premium_storage_account_key.secret) try: container_name = self.get_resource_name('utpremiumcontainer') @@ -2089,11 +2088,10 @@ def test_blob_tier_set_tier_api(self, **kwargs): premium_storage_account_name = kwargs.pop("premium_storage_account_name") premium_storage_account_key = kwargs.pop("premium_storage_account_key") - bsc = BlobServiceClient(self.account_url(premium_storage_account_name, "blob"), credential=premium_storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(premium_storage_account_name, "blob"), credential=premium_storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) url = self.account_url(premium_storage_account_name, "blob") - credential = premium_storage_account_key - pbs = BlobServiceClient(url, credential=credential) + pbs = BlobServiceClient(url, credential=premium_storage_account_key.secret) try: container_name = self.get_resource_name('utpremiumcontainer') @@ -2147,8 +2145,7 @@ def test_blob_tier_copy_blob(self, **kwargs): premium_storage_account_key = kwargs.pop("premium_storage_account_key") url = self.account_url(premium_storage_account_name, "blob") - credential = premium_storage_account_key - pbs = BlobServiceClient(url, credential=credential) + pbs = BlobServiceClient(url, credential=premium_storage_account_key.secret) try: container_name = self.get_resource_name('utpremiumcontainer') @@ -2217,7 +2214,7 @@ def test_download_sparse_page_blob_non_parallel(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) self.config.max_single_get_size = 4*1024 self.config.max_chunk_get_size = 1024 @@ -2256,7 +2253,7 @@ def test_download_sparse_page_blob_parallel(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) self._setup(bsc) self.config.max_single_get_size = 4 * 1024 self.config.max_chunk_get_size = 1024 @@ -2279,7 +2276,7 @@ def test_download_sparse_page_blob_uneven_chunks(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) self._setup(bsc) # Choose an initial size, chunk size, and blob size, so the last chunk spills over end of blob @@ -2317,7 +2314,7 @@ def test_upload_progress_chunked_non_parallel(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) self._setup(bsc) blob_name = self.get_resource_name(TEST_BLOB_PREFIX) @@ -2329,7 +2326,7 @@ def test_upload_progress_chunked_non_parallel(self, **kwargs): blob_client = BlobClient( self.account_url(storage_account_name, 'blob'), self.container_name, blob_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, max_page_size=1024) blob_client.upload_blob( @@ -2349,7 +2346,7 @@ def test_upload_progress_chunked_parallel(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) self._setup(bsc) blob_name = self.get_resource_name(TEST_BLOB_PREFIX) @@ -2361,7 +2358,7 @@ def test_upload_progress_chunked_parallel(self, **kwargs): blob_client = BlobClient( self.account_url(storage_account_name, 'blob'), self.container_name, blob_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, max_page_size=1024) blob_client.upload_blob( 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 c3bd6f925059..d3ba1c93747f 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 @@ -122,7 +122,7 @@ async def test_upload_pages_from_url_with_oauth(self, **kwargs): if not isinstance(account_url, str): account_url = account_url.encode('utf-8') storage_account_key = storage_account_key.encode('utf-8') - bsc = BlobServiceClient(account_url, credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(account_url, credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) access_token = await self.get_credential(BlobServiceClient, is_async=True).get_token("https://storage.azure.com/.default") token = "Bearer {}".format(access_token.token) @@ -148,7 +148,7 @@ async def test_create_blob(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = self._get_blob_reference(bsc) @@ -168,7 +168,7 @@ async def test_create_blob_with_immutability_policy(self, **kwargs): storage_resource_group_name = kwargs.pop("storage_resource_group_name") variables = kwargs.pop("variables", {}) - bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), credential=versioned_storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), credential=versioned_storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) container_name = self.get_resource_name('vlwcontainer') @@ -213,7 +213,7 @@ async def test_create_page_blob_returns_vid(self, **kwargs): versioned_storage_account_name = kwargs.pop("versioned_storage_account_name") versioned_storage_account_key = kwargs.pop("versioned_storage_account_key") - bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), credential=versioned_storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(versioned_storage_account_name, "blob"), credential=versioned_storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = self._get_blob_reference(bsc) @@ -232,7 +232,7 @@ async def test_create_blob_with_metadata(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) # Arrange await self._setup(bsc) blob = self._get_blob_reference(bsc) @@ -251,7 +251,7 @@ async def test_put_page_with_lease_id(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) lease = await blob.acquire_lease(lease_id='00000000-1111-2222-3333-444444444444') @@ -271,7 +271,7 @@ async def test_put_page_with_lease_id_and_if_tags(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) tags = {"tag1 name": "my tag", "tag2": "secondtag", "tag3": "thirdtag"} blob = await self._create_blob(bsc, tags=tags) @@ -298,7 +298,7 @@ async def test_update_page(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -318,7 +318,7 @@ async def test_create_8tb_blob(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = self._get_blob_reference(bsc) @@ -340,7 +340,7 @@ async def test_create_larger_than_8tb_blob_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = self._get_blob_reference(bsc) @@ -354,7 +354,7 @@ async def test_update_8tb_blob_page(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = self._get_blob_reference(bsc) await blob.create_page_blob(EIGHT_TB) @@ -383,7 +383,7 @@ async def test_update_page_with_md5(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -398,7 +398,7 @@ async def test_clear_page(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -416,7 +416,7 @@ async def test_put_page_if_sequence_number_lt_success(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(512) @@ -436,7 +436,7 @@ async def test_update_page_if_sequence_number_lt_failure(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(512) @@ -455,7 +455,7 @@ async def test_update_page_if_sequence_number_lte_success(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(512) @@ -474,7 +474,7 @@ async def test_update_page_if_sequence_number_lte_failure(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(512) @@ -493,7 +493,7 @@ async def test_update_page_if_sequence_number_eq_success(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(512) @@ -512,7 +512,7 @@ async def test_update_page_if_sequence_number_eq_failure(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(512) @@ -532,7 +532,7 @@ async def test_upload_pages_from_url(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) 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) @@ -572,7 +572,7 @@ async def test_upload_pages_from_url_and_validate_content_md5(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) 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) @@ -619,7 +619,7 @@ async def test_upload_pages_from_url_with_source_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) 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) @@ -668,7 +668,7 @@ async def test_upload_pages_from_url_with_source_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) 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) @@ -717,7 +717,7 @@ async def test_upload_pages_from_url_with_source_if_match(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) 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) @@ -762,7 +762,7 @@ async def test_upload_pages_from_url_with_source_if_none_match(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) 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) @@ -805,7 +805,7 @@ async def test_upload_pages_from_url_with_if_modified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) 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) @@ -854,7 +854,7 @@ async def test_upload_pages_from_url_with_if_unmodified(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) 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) @@ -903,7 +903,7 @@ async def test_upload_pages_from_url_with_if_match(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) 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) @@ -948,7 +948,7 @@ async def test_upload_pages_from_url_with_if_none_match(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) 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) @@ -995,7 +995,7 @@ async def test_upload_pages_from_url_with_sequence_number_lt(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) start_sequence = 10 source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) @@ -1041,7 +1041,7 @@ async def test_upload_pages_from_url_with_sequence_number_lte(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) start_sequence = 10 source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) @@ -1087,7 +1087,7 @@ async def test_upload_pages_from_url_with_sequence_number_eq(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) start_sequence = 10 source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE) @@ -1132,7 +1132,7 @@ async def test_update_page_unicode(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -1150,7 +1150,7 @@ async def test_list_page_ranges(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) await self._setup(bsc) blob: BlobClient = await self._create_blob(bsc, length=2560) data = self.get_random_bytes(512) @@ -1178,7 +1178,7 @@ async def test_list_page_ranges_pagination(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) await self._setup(bsc) blob: BlobClient = await self._create_blob(bsc, length=3072) data = self.get_random_bytes(512) @@ -1207,7 +1207,7 @@ async def test_list_page_ranges_empty(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) await self._setup(bsc) blob: BlobClient = await self._create_blob(bsc, length=2560) @@ -1227,7 +1227,7 @@ async def test_list_page_ranges_offset(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) await self._setup(bsc) blob: BlobClient = await self._create_blob(bsc, length=2560) data = self.get_random_bytes(512) @@ -1258,7 +1258,7 @@ async def test_list_page_ranges_diff(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) await self._setup(bsc) blob: BlobClient = await self._create_blob(bsc, length=2048) data = self.get_random_bytes(1536) @@ -1302,7 +1302,7 @@ async def test_list_page_ranges_diff_pagination(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) await self._setup(bsc) blob: BlobClient = await self._create_blob(bsc, length=2048) data = self.get_random_bytes(1536) @@ -1331,7 +1331,7 @@ async def test_get_page_ranges_no_pages(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -1349,7 +1349,7 @@ async def test_get_page_ranges_2_pages(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc, 2048) data = self.get_random_bytes(512) @@ -1374,7 +1374,7 @@ async def test_get_page_ranges_diff(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc, 2048) data = self.get_random_bytes(1536) @@ -1418,7 +1418,7 @@ async def test_get_page_range_diff_for_managed_disk(self, **kwargs): # A Managed Disk account is required to run this test live. # Change this URL as needed. (e.g. partitioned DNS, preprod, etc.) account_url = f"https://{storage_account_name}.blob.core.windows.net/" - credential = {"account_name": storage_account_name, "account_key": storage_account_key} + credential = {"account_name": storage_account_name, "account_key": storage_account_key.secret} bsc = BlobServiceClient(account_url, credential=credential, max_page_size=4 * 1024) await self._setup(bsc) @@ -1484,7 +1484,7 @@ async def test_update_page_fail(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc, 2048) data = self.get_random_bytes(512) @@ -1505,7 +1505,7 @@ async def test_resize_blob(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc, 1024) @@ -1526,7 +1526,7 @@ async def test_set_sequence_number_blob(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = await self._create_blob(bsc) @@ -1547,7 +1547,7 @@ async def test_create_page_blob_with_no_overwrite(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = self._get_blob_reference(bsc) data1 = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1583,7 +1583,7 @@ async def test_create_page_blob_with_overwrite(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = self._get_blob_reference(bsc) data1 = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1617,7 +1617,7 @@ async def test_create_blob_from_bytes(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1637,7 +1637,7 @@ async def test_create_blob_from_0_bytes(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(0) @@ -1657,7 +1657,7 @@ async def test_create_blob_from_bytes_with_progress_first(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1686,7 +1686,7 @@ async def test_create_blob_from_bytes_with_index(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1704,7 +1704,7 @@ async def test_create_blob_from_bytes_with_index_and_count(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1726,7 +1726,7 @@ async def test_create_blob_from_path(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1749,7 +1749,7 @@ async def test_create_blob_from_path_with_progress(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1777,7 +1777,7 @@ async def test_create_blob_from_stream(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1801,7 +1801,7 @@ async def test_create_blob_from_stream_with_empty_pages(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) # data is almost all empty (0s) except two ranges await self._setup(bsc) blob = self._get_blob_reference(bsc) @@ -1836,7 +1836,7 @@ async def test_create_blob_from_stream_non_seekable(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1858,7 +1858,7 @@ async def test_create_blob_from_stream_with_progress(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1887,7 +1887,7 @@ async def test_create_blob_from_stream_truncated(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1908,7 +1908,7 @@ async def test_create_blob_from_stream_with_progress_truncated(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1937,7 +1937,7 @@ async def test_create_blob_with_md5_small(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(512) @@ -1953,10 +1953,10 @@ async def test_create_blob_with_md5_large(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) @@ -1971,7 +1971,7 @@ async def test_incremental_copy_blob(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) try: @@ -2018,11 +2018,10 @@ async def test_blob_tier_on_create(self, **kwargs): premium_storage_account_name = kwargs.pop("premium_storage_account_name") premium_storage_account_key = kwargs.pop("premium_storage_account_key") - bsc = BlobServiceClient(self.account_url(premium_storage_account_name, "blob"), credential=premium_storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(premium_storage_account_name, "blob"), credential=premium_storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) url = self.account_url(premium_storage_account_name, "blob") - credential = premium_storage_account_key - pbs = BlobServiceClient(url, credential=credential) + pbs = BlobServiceClient(url, credential=premium_storage_account_key.secret) try: container_name = self.get_resource_name('utpremiumcontainer') @@ -2075,11 +2074,10 @@ async def test_blob_tier_set_tier_api(self, **kwargs): premium_storage_account_name = kwargs.pop("premium_storage_account_name") premium_storage_account_key = kwargs.pop("premium_storage_account_key") - bsc = BlobServiceClient(self.account_url(premium_storage_account_name, "blob"), credential=premium_storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(premium_storage_account_name, "blob"), credential=premium_storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) url = self.account_url(premium_storage_account_name, "blob") - credential = premium_storage_account_key - pbs = BlobServiceClient(url, credential=credential) + pbs = BlobServiceClient(url, credential=premium_storage_account_key.secret) try: container_name = self.get_resource_name('utpremiumcontainer') @@ -2136,11 +2134,10 @@ async def test_blob_tier_copy_blob(self, **kwargs): premium_storage_account_name = kwargs.pop("premium_storage_account_name") premium_storage_account_key = kwargs.pop("premium_storage_account_key") - bsc = BlobServiceClient(self.account_url(premium_storage_account_name, "blob"), credential=premium_storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(premium_storage_account_name, "blob"), credential=premium_storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) url = self.account_url(premium_storage_account_name, "blob") - credential = premium_storage_account_key - pbs = BlobServiceClient(url, credential=credential) + pbs = BlobServiceClient(url, credential=premium_storage_account_key.secret) try: container_name = self.get_resource_name('utpremiumcontainer') @@ -2152,7 +2149,7 @@ async def test_blob_tier_copy_blob(self, **kwargs): except ResourceExistsError: pass - bsc = BlobServiceClient(self.account_url(premium_storage_account_name, "blob"), credential=premium_storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(premium_storage_account_name, "blob"), credential=premium_storage_account_key.secret, max_page_size=4 * 1024) source_blob = pbs.get_blob_client( container_name, self.get_resource_name(TEST_BLOB_PREFIX)) @@ -2210,7 +2207,7 @@ async def test_download_sparse_page_blob(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key, max_page_size=4 * 1024) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret, max_page_size=4 * 1024) await self._setup(bsc) self.config.max_single_get_size = 4*1024 self.config.max_chunk_get_size = 1024 @@ -2250,7 +2247,7 @@ async def test_download_sparse_page_blob_uneven_chunks(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=storage_account_key.secret) await self._setup(bsc) # Choose an initial size, chunk size, and blob size, so the last chunk spills over end of blob @@ -2288,7 +2285,7 @@ async def test_upload_progress_chunked_non_parallel(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) await self._setup(bsc) blob_name = self.get_resource_name(TEST_BLOB_PREFIX) @@ -2300,7 +2297,7 @@ async def test_upload_progress_chunked_non_parallel(self, **kwargs): blob_client = BlobClient( self.account_url(storage_account_name, 'blob'), self.container_name, blob_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, max_page_size=1024) await blob_client.upload_blob( @@ -2320,7 +2317,7 @@ async def test_upload_progress_chunked_parallel(self, **kwargs): storage_account_key = kwargs.pop("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) + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key.secret) await self._setup(bsc) blob_name = self.get_resource_name(TEST_BLOB_PREFIX) @@ -2332,7 +2329,7 @@ async def test_upload_progress_chunked_parallel(self, **kwargs): blob_client = BlobClient( self.account_url(storage_account_name, 'blob'), self.container_name, blob_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_put_size=1024, max_page_size=1024) await blob_client.upload_blob( diff --git a/sdk/storage/azure-storage-blob/tests/test_quick_query.py b/sdk/storage/azure-storage-blob/tests/test_quick_query.py index fdebf9ec053d..cb53d8248aad 100644 --- a/sdk/storage/azure-storage-blob/tests/test_quick_query.py +++ b/sdk/storage/azure-storage-blob/tests/test_quick_query.py @@ -114,7 +114,7 @@ def test_quick_query_readall(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key) + credential=storage_account_key.secret) self._setup(bsc) # upload the csv file @@ -145,7 +145,7 @@ def test_quick_query_iter_records(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key) + credential=storage_account_key.secret) self._setup(bsc) # upload the csv file @@ -177,7 +177,7 @@ def test_quick_query_readall_with_encoding(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key) + credential=storage_account_key.secret) self._setup(bsc) # upload the csv file @@ -208,7 +208,7 @@ def test_quick_query_iter_records_with_encoding(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key) + credential=storage_account_key.secret) self._setup(bsc) # upload the csv file @@ -235,7 +235,7 @@ def test_quick_query_iter_output_records_excluding_headers(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key) + credential=storage_account_key.secret) self._setup(bsc) # upload the csv file @@ -269,7 +269,7 @@ def test_quick_query_iter_output_records_including_headers(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key) + credential=storage_account_key.secret) self._setup(bsc) # upload the csv file @@ -302,7 +302,7 @@ def test_quick_query_iter_records_with_progress(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key) + credential=storage_account_key.secret) self._setup(bsc) # upload the csv file @@ -332,7 +332,7 @@ def test_quick_query_readall_with_serialization_setting(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key) + credential=storage_account_key.secret) self._setup(bsc) # upload the csv file @@ -379,7 +379,7 @@ def test_quick_query_iter_records_with_serialization_setting(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key) + credential=storage_account_key.secret) self._setup(bsc) # upload the csv file @@ -424,7 +424,7 @@ def test_quick_query_readall_with_fatal_error_handler(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key) + credential=storage_account_key.secret) self._setup(bsc) data1 = b'{name: owner}' @@ -474,7 +474,7 @@ def test_quick_query_iter_records_with_fatal_error_handler(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key) + credential=storage_account_key.secret) self._setup(bsc) data1 = b'{name: owner}' @@ -526,7 +526,7 @@ def test_quick_query_readall_with_fatal_error_handler_raise(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key) + credential=storage_account_key.secret) self._setup(bsc) data1 = b'{name: owner}' @@ -573,7 +573,7 @@ def test_quick_query_iter_records_with_fatal_error_handler_raise(self, **kwargs) # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key) + credential=storage_account_key.secret) self._setup(bsc) data1 = b'{name: owner}' @@ -622,7 +622,7 @@ def test_quick_query_readall_with_fatal_error_ignore(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key) + credential=storage_account_key.secret) self._setup(bsc) data1 = b'{name: owner}' @@ -657,7 +657,7 @@ def test_quick_query_iter_records_with_fatal_error_ignore(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key) + credential=storage_account_key.secret) self._setup(bsc) data1 = b'{name: owner}' @@ -699,7 +699,7 @@ def test_quick_query_readall_with_nonfatal_error_handler(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key) + credential=storage_account_key.secret) self._setup(bsc) # upload the csv file @@ -746,7 +746,7 @@ def test_quick_query_iter_records_with_nonfatal_error_handler(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key) + credential=storage_account_key.secret) self._setup(bsc) # upload the csv file @@ -793,7 +793,7 @@ def test_quick_query_readall_with_nonfatal_error_ignore(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key) + credential=storage_account_key.secret) self._setup(bsc) # upload the csv file @@ -832,7 +832,7 @@ def test_quick_query_iter_records_with_nonfatal_error_ignore(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key) + credential=storage_account_key.secret) self._setup(bsc) # upload the csv file @@ -871,7 +871,7 @@ def test_quick_query_readall_with_json_serialization_setting(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key) + credential=storage_account_key.secret) self._setup(bsc) data1 = b'{\"name\": \"owner\", \"id\": 1}' @@ -911,7 +911,7 @@ def test_quick_query_iter_records_with_json_serialization_setting(self, **kwargs # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key) + credential=storage_account_key.secret) self._setup(bsc) data1 = b'{\"name\": \"owner\", \"id\": 1}' @@ -951,7 +951,7 @@ def test_quick_query_with_only_input_json_serialization_setting(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key) + credential=storage_account_key.secret) self._setup(bsc) data1 = b'{\"name\": \"owner\", \"id\": 1}' @@ -991,7 +991,7 @@ def test_quick_query_output_in_arrow_format(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key) + credential=storage_account_key.secret) self._setup(bsc) data = b'100,200,300,400\n300,400,500,600\n' @@ -1036,7 +1036,7 @@ def test_quick_query_input_in_arrow_format(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key) + credential=storage_account_key.secret) self._setup(bsc) # upload the json file @@ -1064,7 +1064,7 @@ def test_quick_query_input_in_parquet_format(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key) + credential=storage_account_key.secret) self._setup(bsc) expression = "select * from blobstorage where id < 1;" expected_data = b"0,mdifjt55.ea3,mdifjt55.ea3\n" @@ -1089,7 +1089,7 @@ def test_quick_query_output_in_parquet_format(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key) + credential=storage_account_key.secret) self._setup(bsc) expression = "SELECT * from BlobStorage" diff --git a/sdk/storage/azure-storage-blob/tests/test_quick_query_async.py b/sdk/storage/azure-storage-blob/tests/test_quick_query_async.py index 71ac1c85799e..9cd07cbce0f7 100644 --- a/sdk/storage/azure-storage-blob/tests/test_quick_query_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_quick_query_async.py @@ -115,7 +115,7 @@ async def test_quick_query_readall(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) await self._setup(bsc) @@ -146,7 +146,7 @@ async def test_quick_query_iter_records(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) await self._setup(bsc) @@ -179,7 +179,7 @@ async def test_quick_query_readall_with_encoding(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) await self._setup(bsc) @@ -211,7 +211,7 @@ async def test_quick_query_iter_records_with_encoding(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) await self._setup(bsc) @@ -239,7 +239,7 @@ async def test_quick_query_iter_output_records_excluding_headers(self, **kwargs) # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) await self._setup(bsc) @@ -278,7 +278,7 @@ async def test_quick_query_iter_output_records_including_headers(self, **kwargs) # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) await self._setup(bsc) @@ -312,7 +312,7 @@ async def test_quick_query_iter_records_with_progress(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) await self._setup(bsc) @@ -344,7 +344,7 @@ async def test_quick_query_readall_with_serialization_setting(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) await self._setup(bsc) @@ -393,7 +393,7 @@ async def test_quick_query_iter_records_with_serialization_setting(self, **kwarg # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) await self._setup(bsc) @@ -440,7 +440,7 @@ async def test_quick_query_readall_with_fatal_error_handler(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) await self._setup(bsc) @@ -492,7 +492,7 @@ async def test_quick_query_iter_records_with_fatal_error_handler(self, **kwargs) # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) await self._setup(bsc) @@ -546,7 +546,7 @@ async def test_quick_query_readall_with_fatal_error_handler_raise(self, **kwargs # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) await self._setup(bsc) @@ -595,7 +595,7 @@ async def test_quick_query_iter_records_with_fatal_error_handler_raise(self, **k # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) await self._setup(bsc) @@ -646,7 +646,7 @@ async def test_quick_query_readall_with_fatal_error_ignore(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) await self._setup(bsc) @@ -683,7 +683,7 @@ async def test_quick_query_iter_records_with_fatal_error_ignore(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) await self._setup(bsc) @@ -727,7 +727,7 @@ async def test_quick_query_readall_with_nonfatal_error_handler(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) await self._setup(bsc) @@ -777,7 +777,7 @@ async def test_quick_query_iter_records_with_nonfatal_error_handler(self, **kwar # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) await self._setup(bsc) @@ -830,7 +830,7 @@ async def test_quick_query_readall_with_nonfatal_error_ignore(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) await self._setup(bsc) @@ -871,7 +871,7 @@ async def test_quick_query_iter_records_with_nonfatal_error_ignore(self, **kwarg # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) await self._setup(bsc) @@ -916,7 +916,7 @@ async def test_quick_query_readall_with_json_serialization_setting(self, **kwarg # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) await self._setup(bsc) @@ -958,7 +958,7 @@ async def test_quick_query_iter_records_with_json_serialization_setting(self, ** # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) await self._setup(bsc) @@ -1003,7 +1003,7 @@ async def test_quick_query_with_only_input_json_serialization_setting(self, **kw # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) await self._setup(bsc) @@ -1046,7 +1046,7 @@ async def test_quick_query_output_in_arrow_format(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) await self._setup(bsc) @@ -1095,7 +1095,7 @@ async def test_quick_query_input_in_arrow_format(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) await self._setup(bsc) @@ -1128,7 +1128,7 @@ async def test_quick_query_input_in_parquet_format(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) await self._setup(bsc) expression = "select * from blobstorage where id < 1;" @@ -1155,7 +1155,7 @@ async def test_quick_query_output_in_parquet_format(self, **kwargs): # Arrange bsc = BlobServiceClient( self.account_url(storage_account_name, "blob"), - credential=storage_account_key + credential=storage_account_key.secret ) await self._setup(bsc) expression = "SELECT * from BlobStorage" diff --git a/sdk/storage/azure-storage-blob/tests/test_retry.py b/sdk/storage/azure-storage-blob/tests/test_retry.py index 3e0542e1234e..9d5c131e3609 100644 --- a/sdk/storage/azure-storage-blob/tests/test_retry.py +++ b/sdk/storage/azure-storage-blob/tests/test_retry.py @@ -6,6 +6,7 @@ import pytest from unittest import mock from functools import wraps +from typing import NamedTuple from azure.core.exceptions import ( AzureError, @@ -51,7 +52,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, "blob"), credential=key, **kwargs) + service = service_class(self.account_url(account, "blob"), credential=key.secret, **kwargs) return service # --Test Cases -------------------------------------------- @@ -556,7 +557,8 @@ def test_streaming_retry(self, **kwargs): @BlobPreparer() def test_invalid_storage_account_key(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") - storage_account_key = "a" + # secret attribute necessary for credential parameter because of hidden environment variables from loader + storage_account_key = NamedTuple("StorageAccountKey", [("secret", str)])("a") # Arrange blob_client = self._create_storage_service( 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 9ee136b3f679..0c1c51478618 100644 --- a/sdk/storage/azure-storage-blob/tests/test_retry_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_retry_async.py @@ -6,6 +6,7 @@ import asyncio import functools import pytest +from typing import NamedTuple from unittest import mock from aiohttp.client_exceptions import ServerTimeoutError @@ -50,7 +51,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, "blob"), credential=key, **kwargs) + service = service_class(self.account_url(account, "blob"), credential=key.secret, **kwargs) return service # --Test Cases -------------------------------------------- @@ -535,7 +536,8 @@ async def test_streaming_retry(self, **kwargs): @BlobPreparer() async def test_invalid_storage_account_key(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") - storage_account_key = "a" + # secret attribute necessary for credential parameter because of hidden environment variables from loader + storage_account_key = NamedTuple("StorageAccountKey", [("secret", str)])("a") # Arrange blob_client = self._create_storage_service( diff --git a/sdk/storage/azure-storage-blob/tests/test_transports.py b/sdk/storage/azure-storage-blob/tests/test_transports.py index 4ad076ef7543..a4e6258b66c8 100644 --- a/sdk/storage/azure-storage-blob/tests/test_transports.py +++ b/sdk/storage/azure-storage-blob/tests/test_transports.py @@ -16,7 +16,7 @@ class TestStorageTransports(StorageRecordedTestCase): def _setup(self, storage_account_name, key): - self.bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=key) + self.bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=key.secret) self.container_name = self.get_resource_name('utcontainer') if self.is_live: try: @@ -34,7 +34,7 @@ def test_legacy_transport_old_response(self, **kwargs): self.account_url(storage_account_name, "blob"), container_name='container', blob_name='blob', - credential=storage_account_key, + credential=storage_account_key.secret, transport=transport, retry_total=0 ) @@ -62,7 +62,7 @@ def test_legacy_transport_old_response_content_validation(self, **kwargs): self.account_url(storage_account_name, "blob"), container_name='container', blob_name='blob', - credential=storage_account_key, + credential=storage_account_key.secret, transport=transport, retry_total=0 ) @@ -90,7 +90,7 @@ def test_legacy_transport(self, **kwargs): self.account_url(storage_account_name, "blob"), container_name=self.container_name, blob_name=self.get_resource_name('blob'), - credential=storage_account_key, + credential=storage_account_key.secret, transport=transport ) @@ -117,7 +117,7 @@ def test_legacy_transport_content_validation(self, **kwargs): self.account_url(storage_account_name, "blob"), container_name=self.container_name, blob_name=self.get_resource_name('blob'), - credential=storage_account_key, + credential=storage_account_key.secret, transport=transport ) diff --git a/sdk/storage/azure-storage-blob/tests/test_transports_async.py b/sdk/storage/azure-storage-blob/tests/test_transports_async.py index 0d6f03eb02b2..37a660151bf1 100644 --- a/sdk/storage/azure-storage-blob/tests/test_transports_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_transports_async.py @@ -18,7 +18,7 @@ class TestStorageTransportsAsync(AsyncStorageRecordedTestCase): async def _setup(self, storage_account_name, key): - self.bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=key) + self.bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), credential=key.secret) self.container_name = self.get_resource_name('utcontainer') self.byte_data = self.get_random_bytes(1024) if self.is_live: @@ -37,7 +37,7 @@ async def test_legacy_transport_old_response(self, **kwargs): self.account_url(storage_account_name, "blob"), container_name='container', blob_name='blob', - credential=storage_account_key, + credential=storage_account_key.secret, transport=transport, retry_total=0 ) @@ -63,7 +63,7 @@ async def test_legacy_transport_old_response_content_validation(self, **kwargs): self.account_url(storage_account_name, "blob"), container_name='container', blob_name='blob', - credential=storage_account_key, + credential=storage_account_key.secret, transport=transport, retry_total=0 ) @@ -92,7 +92,7 @@ async def test_legacy_transport(self, **kwargs): self.account_url(storage_account_name, "blob"), container_name=self.container_name, blob_name=self.get_resource_name('blob'), - credential=storage_account_key, + credential=storage_account_key.secret, transport=transport ) @@ -120,7 +120,7 @@ async def test_legacy_transport_content_validation(self, **kwargs): self.account_url(storage_account_name, "blob"), container_name=self.container_name, blob_name=self.get_resource_name('blob'), - credential=storage_account_key, + credential=storage_account_key.secret, transport=transport ) @@ -148,7 +148,7 @@ async def test_asyncio_transport(self, **kwargs): self.account_url(storage_account_name, "blob"), container_name=self.container_name, blob_name=self.get_resource_name('blob'), - credential=storage_account_key, + credential=storage_account_key.secret, transport=transport ) @@ -176,7 +176,7 @@ async def test_asyncio_transport_content_validation(self, **kwargs): self.account_url(storage_account_name, "blob"), container_name=self.container_name, blob_name=self.get_resource_name('blob'), - credential=storage_account_key, + credential=storage_account_key.secret, transport=transport ) diff --git a/sdk/storage/azure-storage-file-datalake/tests/settings/testcase.py b/sdk/storage/azure-storage-file-datalake/tests/settings/testcase.py index bfa65c612370..a4d20ec40145 100644 --- a/sdk/storage/azure-storage-file-datalake/tests/settings/testcase.py +++ b/sdk/storage/azure-storage-file-datalake/tests/settings/testcase.py @@ -7,7 +7,7 @@ import functools import os.path -from devtools_testutils import PowerShellPreparer +from devtools_testutils import EnvironmentVariableLoader, EnvironmentVariableOptions from devtools_testutils.fake_credentials import STORAGE_ACCOUNT_FAKE_KEY try: @@ -37,9 +37,10 @@ os.environ['ACCOUNT_URL_SUFFIX'] = ACCOUNT_URL_SUFFIX DataLakePreparer = functools.partial( - PowerShellPreparer, "storage", + EnvironmentVariableLoader, "storage", datalake_storage_account_name="storagename", datalake_storage_account_key=STORAGE_ACCOUNT_FAKE_KEY, storage_data_lake_soft_delete_account_name="storagesoftdelname", storage_data_lake_soft_delete_account_key=STORAGE_ACCOUNT_FAKE_KEY, + options=EnvironmentVariableOptions(hide_secrets=["datalake_storage_account_key", "storage_data_lake_soft_delete_account_key"]), ) diff --git a/sdk/storage/azure-storage-file-datalake/tests/test_cpk.py b/sdk/storage/azure-storage-file-datalake/tests/test_cpk.py index 3cf39f56083e..87cd8651945f 100644 --- a/sdk/storage/azure-storage-file-datalake/tests/test_cpk.py +++ b/sdk/storage/azure-storage-file-datalake/tests/test_cpk.py @@ -24,7 +24,7 @@ class TestDatalakeCpk(StorageRecordedTestCase): def _setup(self, account_name, account_key): url = self.account_url(account_name, 'dfs') - self.dsc = DataLakeServiceClient(url, credential=account_key) + self.dsc = DataLakeServiceClient(url, credential=account_key.secret) self.file_system_name = self.get_resource_name('utfilesystem') if self.is_live: diff --git a/sdk/storage/azure-storage-file-datalake/tests/test_cpk_async.py b/sdk/storage/azure-storage-file-datalake/tests/test_cpk_async.py index 0c1d4c62759d..a262054c17e7 100644 --- a/sdk/storage/azure-storage-file-datalake/tests/test_cpk_async.py +++ b/sdk/storage/azure-storage-file-datalake/tests/test_cpk_async.py @@ -26,7 +26,7 @@ class TestDatalakeCpkAsync(AsyncStorageRecordedTestCase): async def _setup(self, account_name, account_key): url = self.account_url(account_name, 'dfs') - self.dsc = DataLakeServiceClient(url, credential=account_key) + self.dsc = DataLakeServiceClient(url, credential=account_key.secret) self.file_system_name = self.get_resource_name('utfilesystem') if self.is_live: diff --git a/sdk/storage/azure-storage-file-datalake/tests/test_datalake_service_client.py b/sdk/storage/azure-storage-file-datalake/tests/test_datalake_service_client.py index 538a970b1566..396d13749399 100644 --- a/sdk/storage/azure-storage-file-datalake/tests/test_datalake_service_client.py +++ b/sdk/storage/azure-storage-file-datalake/tests/test_datalake_service_client.py @@ -5,6 +5,7 @@ # -------------------------------------------------------------------------- import pytest +from typing import NamedTuple from unittest.mock import MagicMock from azure.core.credentials import AzureNamedKeyCredential @@ -35,7 +36,7 @@ class TestDatalakeService(StorageRecordedTestCase): # --Helpers----------------------------------------------------------------- def _setup(self, account_name, account_key): url = self.account_url(account_name, 'dfs') - self.dsc = DataLakeServiceClient(url, account_key) + self.dsc = DataLakeServiceClient(url, account_key.secret) self.config = self.dsc._config def _assert_properties_default(self, prop): @@ -430,7 +431,7 @@ def test_azure_named_key_credential_access(self, **kwargs): datalake_storage_account_name = kwargs.pop("datalake_storage_account_name") datalake_storage_account_key = kwargs.pop("datalake_storage_account_key") - named_key = AzureNamedKeyCredential(datalake_storage_account_name, datalake_storage_account_key) + named_key = AzureNamedKeyCredential(datalake_storage_account_name, datalake_storage_account_key.secret) dsc = DataLakeServiceClient(self.account_url(datalake_storage_account_name, "blob"), named_key) # Act @@ -442,7 +443,8 @@ def test_azure_named_key_credential_access(self, **kwargs): @DataLakePreparer() def test_datalake_clients_properly_close(self, **kwargs): account_name = "adlsstorage" - account_key = "adlskey" + # secret attribute necessary for credential parameter because of hidden environment variables from loader + account_key = NamedTuple("StorageAccountKey", [("secret", str)])("adlskey") self._setup(account_name, account_key) file_system_client = self.dsc.get_file_system_client(file_system='testfs') diff --git a/sdk/storage/azure-storage-file-datalake/tests/test_datalake_service_client_async.py b/sdk/storage/azure-storage-file-datalake/tests/test_datalake_service_client_async.py index 6b6351c8e14b..606ac56f6b4d 100644 --- a/sdk/storage/azure-storage-file-datalake/tests/test_datalake_service_client_async.py +++ b/sdk/storage/azure-storage-file-datalake/tests/test_datalake_service_client_async.py @@ -6,6 +6,7 @@ import pytest import sys +from typing import NamedTuple from azure.core.credentials import AzureNamedKeyCredential from azure.core.exceptions import ClientAuthenticationError, HttpResponseError @@ -40,7 +41,7 @@ class TestDatalakeServiceAsync(AsyncStorageRecordedTestCase): def _setup(self, account_name, account_key): url = self.account_url(account_name, 'dfs') - self.dsc = DataLakeServiceClient(url, credential=account_key, logging_enable=True) + self.dsc = DataLakeServiceClient(url, credential=account_key.secret, logging_enable=True) self.config = self.dsc._config # --Helpers----------------------------------------------------------------- @@ -432,7 +433,7 @@ async def test_azure_named_key_credential_access(self, **kwargs): datalake_storage_account_name = kwargs.pop("datalake_storage_account_name") datalake_storage_account_key = kwargs.pop("datalake_storage_account_key") - named_key = AzureNamedKeyCredential(datalake_storage_account_name, datalake_storage_account_key) + named_key = AzureNamedKeyCredential(datalake_storage_account_name, datalake_storage_account_key.secret) dsc = DataLakeServiceClient(self.account_url(datalake_storage_account_name, "blob"), named_key) # Act @@ -445,7 +446,8 @@ async def test_azure_named_key_credential_access(self, **kwargs): @DataLakePreparer() async def test_datalake_clients_properly_close(self, **kwargs): account_name = "adlsstorage" - account_key = "adlskey" + # secret attribute necessary for credential parameter because of hidden environment variables from loader + account_key = NamedTuple("StorageAccountKey", [("secret", str)])("adlskey") self._setup(account_name, account_key) file_system_client = self.dsc.get_file_system_client(file_system='testfs') diff --git a/sdk/storage/azure-storage-file-datalake/tests/test_directory.py b/sdk/storage/azure-storage-file-datalake/tests/test_directory.py index 3a7478af1805..1d032e15b8b4 100644 --- a/sdk/storage/azure-storage-file-datalake/tests/test_directory.py +++ b/sdk/storage/azure-storage-file-datalake/tests/test_directory.py @@ -48,7 +48,7 @@ class TestDirectory(StorageRecordedTestCase): def _setUp(self, account_name, account_key): url = self.account_url(account_name, 'dfs') - self.dsc = DataLakeServiceClient(url, credential=account_key, logging_enable=True) + self.dsc = DataLakeServiceClient(url, credential=account_key.secret, logging_enable=True) self.config = self.dsc._config self.file_system_name = self.get_resource_name('filesystem') @@ -1433,7 +1433,7 @@ def test_directory_encryption_scope_from_file_system(self, **kwargs): # Arrange url = self.account_url(datalake_storage_account_name, 'dfs') - self.dsc = DataLakeServiceClient(url, credential=datalake_storage_account_key, logging_enable=True) + self.dsc = DataLakeServiceClient(url, credential=datalake_storage_account_key.secret, logging_enable=True) self.config = self.dsc._config self.file_system_name = self.get_resource_name('filesystem') dir_name = 'testdir' diff --git a/sdk/storage/azure-storage-file-datalake/tests/test_directory_async.py b/sdk/storage/azure-storage-file-datalake/tests/test_directory_async.py index 8d0373c6ff5f..002e453c0e6e 100644 --- a/sdk/storage/azure-storage-file-datalake/tests/test_directory_async.py +++ b/sdk/storage/azure-storage-file-datalake/tests/test_directory_async.py @@ -48,7 +48,7 @@ class TestDirectoryAsync(AsyncStorageRecordedTestCase): async def _setUp(self, account_name, account_key): url = self.account_url(account_name, 'dfs') - self.dsc = DataLakeServiceClient(url, credential=account_key) + self.dsc = DataLakeServiceClient(url, credential=account_key.secret) self.config = self.dsc._config self.file_system_name = self.get_resource_name('filesystem') @@ -1344,7 +1344,7 @@ async def test_rename_dir_with_file_sas(self, **kwargs): token = generate_directory_sas(self.dsc.account_name, self.file_system_name, "olddir", - datalake_storage_account_key, + datalake_storage_account_key.secret, permission=DirectorySasPermissions(read=True, create=True, write=True, delete=True, move=True), expiry=datetime.utcnow() + timedelta(hours=1), @@ -1353,7 +1353,7 @@ async def test_rename_dir_with_file_sas(self, **kwargs): new_token = generate_directory_sas(self.dsc.account_name, self.file_system_name, "newdir", - datalake_storage_account_key, + datalake_storage_account_key.secret, permission=DirectorySasPermissions(read=True, create=True, write=True, delete=True), expiry=datetime.utcnow() + timedelta(hours=1), @@ -1408,7 +1408,7 @@ async def test_directory_encryption_scope_from_file_system_async(self, **kwargs) # Arrange url = self.account_url(datalake_storage_account_name, 'dfs') - self.dsc = DataLakeServiceClient(url, credential=datalake_storage_account_key, logging_enable=True) + self.dsc = DataLakeServiceClient(url, credential=datalake_storage_account_key.secret, logging_enable=True) self.config = self.dsc._config self.file_system_name = self.get_resource_name('filesystem') dir_name = 'testdir' diff --git a/sdk/storage/azure-storage-file-datalake/tests/test_file.py b/sdk/storage/azure-storage-file-datalake/tests/test_file.py index 85a63832f6c1..8dc309f0a009 100644 --- a/sdk/storage/azure-storage-file-datalake/tests/test_file.py +++ b/sdk/storage/azure-storage-file-datalake/tests/test_file.py @@ -50,7 +50,7 @@ class TestFile(StorageRecordedTestCase): def _setUp(self, account_name, account_key): url = self.account_url(account_name, 'dfs') - self.dsc = DataLakeServiceClient(url, credential=account_key, logging_enable=True) + self.dsc = DataLakeServiceClient(url, credential=account_key.secret, logging_enable=True) self.config = self.dsc._config self.file_system_name = self.get_resource_name('filesystem') @@ -244,7 +244,7 @@ def test_create_file_extra_backslashes(self, **kwargs): new_file_client = DataLakeFileClient(self.account_url(datalake_storage_account_name, 'dfs'), file_client.file_system_name + '/', '/' + file_client.path_name, - credential=datalake_storage_account_key, logging_enable=True) + credential=datalake_storage_account_key.secret, logging_enable=True) response = new_file_client.create_file() # Assert @@ -1228,7 +1228,7 @@ def test_file_encryption_scope_from_file_system(self, **kwargs): # Arrange url = self.account_url(datalake_storage_account_name, 'dfs') - self.dsc = DataLakeServiceClient(url, credential=datalake_storage_account_key, logging_enable=True) + self.dsc = DataLakeServiceClient(url, credential=datalake_storage_account_key.secret, logging_enable=True) self.file_system_name = self.get_resource_name('filesystem') file_name = 'testfile' encryption_scope = EncryptionScopeOptions(default_encryption_scope="hnstestscope1") @@ -1284,7 +1284,7 @@ def test_rename_file_with_file_sas(self, **kwargs): self.file_system_name, None, "oldfile", - datalake_storage_account_key, + datalake_storage_account_key.secret, permission=FileSasPermissions(read=True, create=True, write=True, delete=True), expiry=datetime.utcnow() + timedelta(hours=1), ) @@ -1293,7 +1293,7 @@ def test_rename_file_with_file_sas(self, **kwargs): self.file_system_name, None, "newname", - datalake_storage_account_key, + datalake_storage_account_key.secret, permission=FileSasPermissions(read=True, create=True, write=True, delete=True), expiry=datetime.utcnow() + timedelta(hours=1), ) @@ -1500,7 +1500,7 @@ def test_create_and_read_file_encryption_context(self, **kwargs): # Arrange url = self.account_url(datalake_storage_account_name, 'dfs') - self.dsc = DataLakeServiceClient(url, credential=datalake_storage_account_key) + self.dsc = DataLakeServiceClient(url, credential=datalake_storage_account_key.secret) self.file_system_name = self.get_resource_name('filesystem') file_name = 'testfile' file_system = self.dsc.get_file_system_client(self.file_system_name) @@ -1537,7 +1537,7 @@ def test_upload_file_encryption_context(self, **kwargs): # Arrange url = self.account_url(datalake_storage_account_name, 'dfs') - self.dsc = DataLakeServiceClient(url, credential=datalake_storage_account_key) + self.dsc = DataLakeServiceClient(url, credential=datalake_storage_account_key.secret) self.file_system_name = self.get_resource_name('filesystem') data = self.get_random_bytes(200 * 1024) file_name = 'testfile' @@ -1649,7 +1649,7 @@ def test_mock_transport_no_content_validation(self, **kwargs): self.account_url(datalake_storage_account_name, 'dfs'), "filesystem/", "dir/file.txt", - credential=datalake_storage_account_key, + credential=datalake_storage_account_key.secret, transport=transport, retry_total=0 ) @@ -1680,7 +1680,7 @@ def test_mock_transport_with_content_validation(self, **kwargs): self.account_url(datalake_storage_account_name, 'dfs'), "filesystem/", "dir/file.txt", - credential=datalake_storage_account_key, + credential=datalake_storage_account_key.secret, transport=transport, retry_total=0 ) @@ -1759,7 +1759,7 @@ def test_download_file_no_decompress_chunks(self, **kwargs): self.account_url(datalake_storage_account_name, 'dfs'), self.file_system_name, file_name, - credential=datalake_storage_account_key, + credential=datalake_storage_account_key.secret, max_chunk_get_size=4, max_single_get_size=4, ) diff --git a/sdk/storage/azure-storage-file-datalake/tests/test_file_async.py b/sdk/storage/azure-storage-file-datalake/tests/test_file_async.py index 428383995abc..9d21e945d4bf 100644 --- a/sdk/storage/azure-storage-file-datalake/tests/test_file_async.py +++ b/sdk/storage/azure-storage-file-datalake/tests/test_file_async.py @@ -47,7 +47,7 @@ class TestFileAsync(AsyncStorageRecordedTestCase): async def _setUp(self, account_name, account_key): url = self.account_url(account_name, 'dfs') - self.dsc = DataLakeServiceClient(url, credential=account_key) + self.dsc = DataLakeServiceClient(url, credential=account_key.secret) self.config = self.dsc._config @@ -245,7 +245,7 @@ async def test_create_file_extra_backslashes(self, **kwargs): new_file_client = DataLakeFileClient(self.account_url(datalake_storage_account_name, 'dfs'), file_client.file_system_name + '/', '/' + file_client.path_name, - credential=datalake_storage_account_key, logging_enable=True) + credential=datalake_storage_account_key.secret, logging_enable=True) response = await new_file_client.create_file() # Assert @@ -1202,7 +1202,7 @@ async def test_file_encryption_scope_from_file_system_async(self, **kwargs): # Arrange url = self.account_url(datalake_storage_account_name, 'dfs') - self.dsc = DataLakeServiceClient(url, credential=datalake_storage_account_key, logging_enable=True) + self.dsc = DataLakeServiceClient(url, credential=datalake_storage_account_key.secret, logging_enable=True) self.file_system_name = self.get_resource_name('filesystem') file_name = 'testfile' encryption_scope = EncryptionScopeOptions(default_encryption_scope="hnstestscope1") @@ -1230,7 +1230,7 @@ async def test_rename_file_with_file_sas(self, **kwargs): self.file_system_name, None, "oldfile", - datalake_storage_account_key, + datalake_storage_account_key.secret, permission=FileSasPermissions(read=True, create=True, write=True, delete=True, move=True), expiry=datetime.utcnow() + timedelta(hours=1), ) @@ -1239,7 +1239,7 @@ async def test_rename_file_with_file_sas(self, **kwargs): self.file_system_name, None, "newname", - datalake_storage_account_key, + datalake_storage_account_key.secret, permission=FileSasPermissions(read=True, create=True, write=True, delete=True), expiry=datetime.utcnow() + timedelta(hours=1), ) @@ -1395,7 +1395,7 @@ async def test_create_and_read_file_encryption_context(self, **kwargs): # Arrange await self._setUp(datalake_storage_account_name, datalake_storage_account_key) url = self.account_url(datalake_storage_account_name, 'dfs') - self.dsc = DataLakeServiceClient(url, credential=datalake_storage_account_key) + self.dsc = DataLakeServiceClient(url, credential=datalake_storage_account_key.secret) self.file_system_name = self.get_resource_name('filesystem') file_name = 'testfile' file_system = self.dsc.get_file_system_client(self.file_system_name) @@ -1435,7 +1435,7 @@ async def test_upload_file_encryption_context(self, **kwargs): # Arrange await self._setUp(datalake_storage_account_name, datalake_storage_account_key) url = self.account_url(datalake_storage_account_name, 'dfs') - self.dsc = DataLakeServiceClient(url, credential=datalake_storage_account_key) + self.dsc = DataLakeServiceClient(url, credential=datalake_storage_account_key.secret) self.file_system_name = self.get_resource_name('filesystem') data = self.get_random_bytes(200 * 1024) file_name = 'testfile' @@ -1547,7 +1547,7 @@ async def test_mock_transport_no_content_validation(self, **kwargs): self.account_url(datalake_storage_account_name, 'dfs'), "filesystem/", "dir/file.txt", - credential=datalake_storage_account_key, + credential=datalake_storage_account_key.secret, transport=transport, retry_total=0 ) @@ -1581,7 +1581,7 @@ async def test_mock_transport_with_content_validation(self, **kwargs): self.account_url(datalake_storage_account_name, 'dfs'), "filesystem/", "dir/file.txt", - credential=datalake_storage_account_key, + credential=datalake_storage_account_key.secret, transport=transport, retry_total=0 ) @@ -1663,7 +1663,7 @@ async def test_download_file_no_decompress_chunks(self, **kwargs): self.account_url(datalake_storage_account_name, 'dfs'), self.file_system_name, file_name, - credential=datalake_storage_account_key, + credential=datalake_storage_account_key.secret, max_chunk_get_size=4, max_single_get_size=4, ) diff --git a/sdk/storage/azure-storage-file-datalake/tests/test_file_system.py b/sdk/storage/azure-storage-file-datalake/tests/test_file_system.py index bf3f17ab20ea..83fa05b5d886 100644 --- a/sdk/storage/azure-storage-file-datalake/tests/test_file_system.py +++ b/sdk/storage/azure-storage-file-datalake/tests/test_file_system.py @@ -41,7 +41,7 @@ class TestFileSystem(StorageRecordedTestCase): def _setUp(self, account_name, account_key): url = self.account_url(account_name, 'dfs') - self.dsc = DataLakeServiceClient(url, account_key) + self.dsc = DataLakeServiceClient(url, account_key.secret) self.config = self.dsc._config self.test_file_systems = [] @@ -411,7 +411,7 @@ def test_list_file_systems_account_sas(self, **kwargs): sas_token = self.generate_sas( generate_account_sas, datalake_storage_account_name, - datalake_storage_account_key, + datalake_storage_account_key.secret, ResourceTypes(service=True), AccountSasPermissions(list=True), datetime.utcnow() + timedelta(hours=1), @@ -483,7 +483,7 @@ def test_list_system_filesystems(self, **kwargs): self._setUp(datalake_storage_account_name, datalake_storage_account_key) # Arrange - dsc = DataLakeServiceClient(self.dsc.url, credential=datalake_storage_account_key) + dsc = DataLakeServiceClient(self.dsc.url, credential=datalake_storage_account_key.secret) # Act filesystems = list(dsc.list_file_systems(include_system=True)) @@ -712,8 +712,8 @@ def test_service_client_session_closes_after_filesystem_creation(self, **kwargs) self._setUp(datalake_storage_account_name, datalake_storage_account_key) # Arrange - dsc2 = DataLakeServiceClient(self.dsc.url, credential=datalake_storage_account_key) - with DataLakeServiceClient(self.dsc.url, credential=datalake_storage_account_key) as ds_client: + dsc2 = DataLakeServiceClient(self.dsc.url, credential=datalake_storage_account_key.secret) + with DataLakeServiceClient(self.dsc.url, credential=datalake_storage_account_key.secret) as ds_client: fs1 = ds_client.create_file_system(self._get_file_system_reference(prefix="fs1")) fs1.delete_file_system() dsc2.create_file_system(self._get_file_system_reference(prefix="fs2")) diff --git a/sdk/storage/azure-storage-file-datalake/tests/test_file_system_async.py b/sdk/storage/azure-storage-file-datalake/tests/test_file_system_async.py index a73246a1e2ab..aefc31bc13da 100644 --- a/sdk/storage/azure-storage-file-datalake/tests/test_file_system_async.py +++ b/sdk/storage/azure-storage-file-datalake/tests/test_file_system_async.py @@ -41,7 +41,7 @@ class TestFileSystemAsync(AsyncStorageRecordedTestCase): def _setUp(self, account_name, account_key): url = self.account_url(account_name, 'dfs') - self.dsc = DataLakeServiceClient(url, credential=account_key, logging_enable=True) + self.dsc = DataLakeServiceClient(url, credential=account_key.secret, logging_enable=True) self.config = self.dsc._config self.test_file_systems = [] @@ -384,7 +384,7 @@ async def test_list_file_systems_account_sas(self, **kwargs): sas_token = self.generate_sas( generate_account_sas, datalake_storage_account_name, - datalake_storage_account_key, + datalake_storage_account_key.secret, ResourceTypes(service=True), AccountSasPermissions(list=True), datetime.utcnow() + timedelta(hours=1), @@ -713,9 +713,9 @@ async def test_service_client_session_closes_after_filesystem_creation(self, **k self._setUp(datalake_storage_account_name, datalake_storage_account_key) # Arrange - dsc2 = DataLakeServiceClient(self.dsc.url, credential=datalake_storage_account_key) + dsc2 = DataLakeServiceClient(self.dsc.url, credential=datalake_storage_account_key.secret) async with DataLakeServiceClient( - self.dsc.url, credential=datalake_storage_account_key) as ds_client: + self.dsc.url, credential=datalake_storage_account_key.secret) as ds_client: fs1 = await ds_client.create_file_system(self._get_file_system_reference(prefix="fs1")) await fs1.delete_file_system() await dsc2.create_file_system(self._get_file_system_reference(prefix="fs2")) @@ -814,7 +814,7 @@ async def test_list_system_filesystems(self, **kwargs): self._setUp(datalake_storage_account_name, datalake_storage_account_key) # Arrange - dsc = DataLakeServiceClient(self.dsc.url, credential=datalake_storage_account_key) + dsc = DataLakeServiceClient(self.dsc.url, credential=datalake_storage_account_key.secret) # Act filesystems = [] async for fs in dsc.list_file_systems(include_system=True): diff --git a/sdk/storage/azure-storage-file-datalake/tests/test_large_file.py b/sdk/storage/azure-storage-file-datalake/tests/test_large_file.py index f74c4137b95d..f93a4c40d67d 100644 --- a/sdk/storage/azure-storage-file-datalake/tests/test_large_file.py +++ b/sdk/storage/azure-storage-file-datalake/tests/test_large_file.py @@ -30,9 +30,9 @@ def _setUp(self, account_name, account_key): url = self.account_url(account_name, 'dfs') self.payload_dropping_policy = PayloadDroppingPolicy() credential_policy = _format_shared_key_credential(account_name, - account_key) + account_key.secret) self.dsc = DataLakeServiceClient(url, - credential=account_key, + credential=account_key.secret, logging_enable=True, _additional_pipeline_policies=[self.payload_dropping_policy, credential_policy]) self.config = self.dsc._config diff --git a/sdk/storage/azure-storage-file-datalake/tests/test_large_file_async.py b/sdk/storage/azure-storage-file-datalake/tests/test_large_file_async.py index 4802f844ece8..ed3155307704 100644 --- a/sdk/storage/azure-storage-file-datalake/tests/test_large_file_async.py +++ b/sdk/storage/azure-storage-file-datalake/tests/test_large_file_async.py @@ -31,9 +31,9 @@ class TestLargeFileAsync(AsyncStorageRecordedTestCase): async def _setUp(self, account_name, account_key): url = self.account_url(account_name, 'dfs') self.payload_dropping_policy = PayloadDroppingPolicy() - credential_policy = _format_shared_key_credential(account_name, account_key) + credential_policy = _format_shared_key_credential(account_name, account_key.secret) self.dsc = DataLakeServiceClient(url, - credential=account_key, + credential=account_key.secret, _additional_pipeline_policies=[self.payload_dropping_policy, credential_policy]) self.config = self.dsc._config diff --git a/sdk/storage/azure-storage-file-datalake/tests/test_quick_query.py b/sdk/storage/azure-storage-file-datalake/tests/test_quick_query.py index fbef6216de97..4d40d5c4cdd3 100644 --- a/sdk/storage/azure-storage-file-datalake/tests/test_quick_query.py +++ b/sdk/storage/azure-storage-file-datalake/tests/test_quick_query.py @@ -116,7 +116,7 @@ class TestStorageQuickQuery(StorageRecordedTestCase): def _setUp(self, account_name, account_key): url = self.account_url(account_name, 'dfs') - self.dsc = DataLakeServiceClient(url, credential=account_key, logging_enable=True) + self.dsc = DataLakeServiceClient(url, credential=account_key.secret, logging_enable=True) self.config = self.dsc._config self.filesystem_name = self.get_resource_name('utqqcontainer') # cspell:disable-line diff --git a/sdk/storage/azure-storage-file-share/tests/settings/testcase.py b/sdk/storage/azure-storage-file-share/tests/settings/testcase.py index c54a3c33e4ef..7e5a94151067 100644 --- a/sdk/storage/azure-storage-file-share/tests/settings/testcase.py +++ b/sdk/storage/azure-storage-file-share/tests/settings/testcase.py @@ -15,7 +15,7 @@ import mock import logging -from devtools_testutils import PowerShellPreparer +from devtools_testutils import EnvironmentVariableLoader, EnvironmentVariableOptions from devtools_testutils.fake_credentials import STORAGE_ACCOUNT_FAKE_KEY try: from cStringIO import StringIO # Python 2 @@ -51,13 +51,14 @@ FileSharePreparer = functools.partial( - PowerShellPreparer, "storage", + EnvironmentVariableLoader, "storage", storage_account_name="storagename", storage_account_key=STORAGE_ACCOUNT_FAKE_KEY, premium_storage_file_account_name="pyacrstoragestorname", premium_storage_file_account_key=STORAGE_ACCOUNT_FAKE_KEY, secondary_storage_account_name="pyrmtstoragestorname", secondary_storage_account_key=STORAGE_ACCOUNT_FAKE_KEY, + options=EnvironmentVariableOptions(hide_secrets=["storage_account_key", "secondary_storage_account_key", "premium_storage_file_account_key"]), ) diff --git a/sdk/storage/azure-storage-file-share/tests/test_directory.py b/sdk/storage/azure-storage-file-share/tests/test_directory.py index f2d4a0089ddd..d5e59e77beef 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_directory.py +++ b/sdk/storage/azure-storage-file-share/tests/test_directory.py @@ -32,7 +32,7 @@ class TestStorageDirectory(StorageRecordedTestCase): def _setup(self, storage_account_name, storage_account_key): url = self.account_url(storage_account_name, "file") credential = storage_account_key - self.fsc = ShareServiceClient(url, credential=credential) + self.fsc = ShareServiceClient(url, credential=credential.secret) self.share_name = self.get_resource_name('utshare') if not self.is_playback(): @@ -163,7 +163,7 @@ def test_create_directory_with_trailing_dot(self, **kwargs): directory_client = ShareDirectoryClient( self.account_url(storage_account_name, 'file'), share_client.share_name, directory_name + '.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True) # Act @@ -385,7 +385,7 @@ def test_get_directory_properties_with_trailing_dot(self, **kwargs): directory = ShareDirectoryClient( self.account_url(storage_account_name, 'file'), share_client.share_name, 'dir1.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True) # Act @@ -676,7 +676,7 @@ def test_set_http_headers_with_trailing_dot(self, **kwargs): directory_client = ShareDirectoryClient( self.account_url(storage_account_name, 'file'), share_client.share_name, 'dir1.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True) directory_client.create_directory() @@ -793,7 +793,7 @@ def test_list_subdirectories_with_trailing_dot(self, **kwargs): directory = ShareDirectoryClient( self.account_url(storage_account_name, 'file'), share_client.share_name, 'dir1.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True) directory.create_directory() directory.create_subdirectory("subdir1.") @@ -1072,7 +1072,7 @@ def test_delete_directory_with_trailing_dot(self, **kwargs): directory = ShareDirectoryClient( self.account_url(storage_account_name, 'file'), share_client.share_name, 'dir1.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True) # Act @@ -1350,7 +1350,7 @@ def test_rename_directory_trailing_dot(self, **kwargs): directory_client = ShareDirectoryClient( self.account_url(storage_account_name, 'file'), share_client.share_name, 'dir1.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True, allow_source_trailing_dot=True) @@ -1373,7 +1373,7 @@ def test_storage_account_audience_directory_client(self, **kwargs): directory_client = ShareDirectoryClient( self.account_url(storage_account_name, 'file'), share_client.share_name, 'dir1.', - credential=storage_account_key + credential=storage_account_key.secret ) directory_client.exists() @@ -1403,7 +1403,7 @@ def test_bad_audience_directory_client(self, **kwargs): directory_client = ShareDirectoryClient( self.account_url(storage_account_name, 'file'), share_client.share_name, 'dir1.', - credential=storage_account_key + credential=storage_account_key.secret ) directory_client.exists() diff --git a/sdk/storage/azure-storage-file-share/tests/test_directory_async.py b/sdk/storage/azure-storage-file-share/tests/test_directory_async.py index d1010ced0b09..aab82f8447bd 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_directory_async.py +++ b/sdk/storage/azure-storage-file-share/tests/test_directory_async.py @@ -35,7 +35,7 @@ class TestStorageDirectoryAsync(AsyncStorageRecordedTestCase): async def _setup(self, storage_account_name, storage_account_key): url = self.account_url(storage_account_name, "file") credential = storage_account_key - self.fsc = ShareServiceClient(url, credential=credential) + self.fsc = ShareServiceClient(url, credential=credential.secret) self.share_name = self.get_resource_name('utshare') if not self.is_playback(): try: @@ -170,7 +170,7 @@ async def test_create_directory_with_trailing_dot(self, **kwargs): directory_client = ShareDirectoryClient( self.account_url(storage_account_name, 'file'), share_client.share_name, directory_name + '.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True) # Act @@ -390,7 +390,7 @@ async def test_get_directory_properties_with_trailing_dot(self, **kwargs): directory = ShareDirectoryClient( self.account_url(storage_account_name, 'file'), share_client.share_name, 'dir1.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True) # Act @@ -709,7 +709,7 @@ async def test_set_http_headers_with_trailing_dot(self, **kwargs): directory_client = ShareDirectoryClient( self.account_url(storage_account_name, 'file'), share_client.share_name, 'dir1.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True) await directory_client.create_directory() @@ -842,7 +842,7 @@ async def test_list_subdirectories_with_trailing_dot(self, **kwargs): directory = ShareDirectoryClient( self.account_url(storage_account_name, 'file'), share_client.share_name, 'dir1.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True) await directory.create_directory() await asyncio.gather( @@ -1163,7 +1163,7 @@ async def test_delete_directory_with_trailing_dot(self, **kwargs): directory = ShareDirectoryClient( self.account_url(storage_account_name, 'file'), share_client.share_name, 'dir1.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True) # Act @@ -1453,7 +1453,7 @@ async def test_rename_directory_trailing_dot(self, **kwargs): directory_client = ShareDirectoryClient( self.account_url(storage_account_name, 'file'), share_client.share_name, 'dir1.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True, allow_source_trailing_dot=True) @@ -1476,7 +1476,7 @@ async def test_storage_account_audience_directory_client(self, **kwargs): directory_client = ShareDirectoryClient( self.account_url(storage_account_name, 'file'), share_client.share_name, 'dir1.', - credential=storage_account_key + credential=storage_account_key.secret ) await directory_client.exists() @@ -1506,7 +1506,7 @@ async def test_bad_audience_directory_client(self, **kwargs): directory_client = ShareDirectoryClient( self.account_url(storage_account_name, 'file'), share_client.share_name, 'dir1.', - credential=storage_account_key + credential=storage_account_key.secret ) await directory_client.exists() diff --git a/sdk/storage/azure-storage-file-share/tests/test_file.py b/sdk/storage/azure-storage-file-share/tests/test_file.py index dae4be5d8059..1224a52dbbd8 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_file.py +++ b/sdk/storage/azure-storage-file-share/tests/test_file.py @@ -57,8 +57,8 @@ def _setup(self, storage_account_name, storage_account_key, rmt_account=None, rm # 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.fsc = ShareServiceClient(url, credential=credential, max_range_size=4 * 1024) - self.bsc = BlobServiceClient(blob_url, credential=credential) + self.fsc = ShareServiceClient(url, credential=credential.secret, max_range_size=4 * 1024) + self.bsc = BlobServiceClient(blob_url, credential=credential.secret) self.share_name = self.get_resource_name('utshare') self.source_container_name = self.get_resource_name('sourceshare') if self.is_live: @@ -197,7 +197,7 @@ def test_make_file_url_with_protocol(self, **kwargs): self._setup(storage_account_name, storage_account_key) url = self.account_url(storage_account_name, "file").replace('https', 'http') - fsc = ShareServiceClient(url, credential=storage_account_key) + fsc = ShareServiceClient(url, credential=storage_account_key.secret) share = fsc.get_share_client("vhds") file_client = share.get_file_client("vhd_dir/my.vhd") @@ -241,7 +241,7 @@ def test_exists(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) # Act / Assert assert not file_client.exists() @@ -261,7 +261,7 @@ def test_create_file(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) # Act resp = file_client.create_file(1024, file_attributes="hidden") @@ -334,7 +334,7 @@ def test_create_file_with_trailing_dot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + '.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True) # Act @@ -362,7 +362,7 @@ def test_create_file_with_trailing_dot_false(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + '.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=False) # Act @@ -373,7 +373,7 @@ def test_create_file_with_trailing_dot_false(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + '.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=False) # create file client without dot @@ -381,7 +381,7 @@ def test_create_file_with_trailing_dot_false(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=False) props = file_client.get_file_properties() @@ -409,7 +409,7 @@ def test_create_file_with_metadata(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) # Act resp = file_client.create_file(1024, metadata=metadata) @@ -434,7 +434,7 @@ def test_create_file_with_metadata_with_trailing_dot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + '.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True) # Act @@ -485,7 +485,7 @@ def test_create_file_semantics(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + "file1", - credential=storage_account_key + credential=storage_account_key.secret ) file1.create_file(1024, file_property_semantics=None) props = file1.get_file_properties() @@ -495,7 +495,7 @@ def test_create_file_semantics(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + "file2", - credential=storage_account_key + credential=storage_account_key.secret ) file2.create_file(1024, file_property_semantics="New") props = file2.get_file_properties() @@ -505,7 +505,7 @@ def test_create_file_semantics(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + "file2", - credential=storage_account_key + credential=storage_account_key.secret ) file3.create_file(1024, file_property_semantics="Restore", file_permission=TEST_FILE_PERMISSIONS) props = file3.get_file_properties() @@ -625,7 +625,7 @@ def test_lease_operations_trailing_dot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + '.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True) file_client.create_file(1024) @@ -727,7 +727,7 @@ def test_file_not_exists(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path="missingdir/" + file_name, - credential=storage_account_key) + credential=storage_account_key.secret) # Act with pytest.raises(ResourceNotFoundError): @@ -753,7 +753,7 @@ def test_file_exists_with_snapshot(self, **kwargs): share_name=self.share_name, file_path=file_client.file_name, snapshot=snapshot, - credential=storage_account_key) + credential=storage_account_key.secret) props = snapshot_client.get_file_properties() # Assert @@ -804,7 +804,7 @@ def test_file_not_exists_with_snapshot(self, **kwargs): share_name=self.share_name, file_path=file_client.file_name, snapshot=snapshot, - credential=storage_account_key) + credential=storage_account_key.secret) # Assert with pytest.raises(ResourceNotFoundError): @@ -913,7 +913,7 @@ def test_set_file_properties_trailing_dot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + '.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True) file_client.create_file(1024) @@ -1051,7 +1051,7 @@ def test_get_file_properties_trailing_dot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + '.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True) resp = file_client.create_file(1024) @@ -1060,7 +1060,7 @@ def test_get_file_properties_trailing_dot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) with pytest.raises(HttpResponseError): file_client_no_dot.get_file_properties() @@ -1114,7 +1114,7 @@ def test_get_file_properties_with_snapshot(self, **kwargs): share_name=self.share_name, file_path=file_client.file_name, snapshot=snapshot, - credential=storage_account_key) + credential=storage_account_key.secret) snapshot_props = snapshot_client.get_file_properties() # Assert @@ -1141,7 +1141,7 @@ def test_get_file_metadata_with_snapshot(self, **kwargs): share_name=self.share_name, file_path=file_client.file_name, snapshot=snapshot, - credential=storage_account_key) + credential=storage_account_key.secret) metadata2 = {"test100": "foo100", "test200": "bar200"} file_client.set_file_metadata(metadata2) @@ -1166,7 +1166,7 @@ def test_get_file_properties_with_non_existing_file(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) # Act with pytest.raises(ResourceNotFoundError): @@ -1344,7 +1344,7 @@ def test_delete_file_with_existing_file_trailing_dot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + '.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True) resp = file_client.create_file(1024) @@ -1367,7 +1367,7 @@ def test_delete_file_with_non_existing_file(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) # Act with pytest.raises(ResourceNotFoundError): @@ -1406,7 +1406,7 @@ def test_update_range_trailing_dot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + '.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True) file_client.upload_file(self.short_byte_data) @@ -1790,7 +1790,7 @@ def test_clear_range_trailing_dot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + '.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True) file_client.upload_file(self.short_byte_data) @@ -1838,7 +1838,7 @@ def test_list_ranges_none(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) file_client.create_file(1024) # Act @@ -1860,7 +1860,7 @@ def test_list_ranges_none_trailing_dot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + '.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True) file_client.create_file(1024) @@ -1885,7 +1885,7 @@ def test_list_ranges_none_with_invalid_lease_fails(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) file_client.create_file(1024) file_client.acquire_lease(lease_id='00000000-1111-2222-3333-444444444444') @@ -1913,7 +1913,7 @@ def test_list_ranges_diff(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) file_client.create_file(2048) share_client = self.fsc.get_share_client(self.share_name) @@ -2009,7 +2009,7 @@ def test_list_ranges_diff_trailing_dot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + '.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True) file_client.create_file(2048) @@ -2060,7 +2060,7 @@ def test_list_ranges_diff_support_rename(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) file_client.create_file(2048) share_client = self.fsc.get_share_client(self.share_name) @@ -2099,7 +2099,7 @@ def test_list_ranges_2(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) file_client.create_file(2048) data = b'abcdefghijklmnop' * 32 @@ -2129,7 +2129,7 @@ def test_list_ranges_none_from_snapshot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) file_client.create_file(1024) share_client = self.fsc.get_share_client(self.share_name) @@ -2139,7 +2139,7 @@ def test_list_ranges_none_from_snapshot(self, **kwargs): share_name=self.share_name, file_path=file_client.file_name, snapshot=snapshot, - credential=storage_account_key) + credential=storage_account_key.secret) file_client.delete_file() @@ -2198,7 +2198,7 @@ def test_list_ranges_2_from_snapshot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) file_client.create_file(2048) data = b'abcdefghijklmnop' * 32 resp1 = file_client.upload_range(data, offset=0, length=512) @@ -2211,7 +2211,7 @@ def test_list_ranges_2_from_snapshot(self, **kwargs): share_name=self.share_name, file_path=file_client.file_name, snapshot=snapshot, - credential=storage_account_key) + credential=storage_account_key.secret) file_client.delete_file() @@ -2238,7 +2238,7 @@ def test_copy_file_with_existing_file(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path='file1copy', - credential=storage_account_key) + credential=storage_account_key.secret) # Act copy = file_client.start_copy_from_url(source_client.url) @@ -2290,7 +2290,7 @@ def test_copy_file_with_existing_file_trailing_dot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + '.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True) source_client.upload_file(self.short_byte_data) @@ -2298,7 +2298,7 @@ def test_copy_file_with_existing_file_trailing_dot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path='file1copy.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True, allow_source_trailing_dot=True) @@ -2325,7 +2325,7 @@ def test_copy_existing_file_with_lease(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path='file1copy', - credential=storage_account_key) + credential=storage_account_key.secret) file_client.create_file(1024) lease = file_client.acquire_lease(lease_id='00000000-1111-2222-3333-444444444444') @@ -2355,7 +2355,7 @@ def test_copy_file_ignore_readonly(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path='file1copy', - credential=storage_account_key) + credential=storage_account_key.secret) file_attributes = NTFSAttributes(read_only=True) dest_file.create_file(1024, file_attributes=file_attributes) @@ -2386,7 +2386,7 @@ def test_copy_file_with_specifying_acl_copy_behavior_attributes(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path='file1copy', - credential=storage_account_key) + credential=storage_account_key.secret) source_props = source_client.get_file_properties() file_creation_time = source_props.creation_time - timedelta(hours=1) @@ -2435,7 +2435,7 @@ def test_copy_file_with_specifying_acl_and_attributes_from_source(self, **kwargs self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path='file1copy', - credential=storage_account_key) + credential=storage_account_key.secret) # Act copy = file_client.start_copy_from_url( @@ -2463,7 +2463,7 @@ def test_copy_file_async_private_file(self, **kwargs): secondary_storage_account_name = kwargs.pop("secondary_storage_account_name") secondary_storage_account_key = kwargs.pop("secondary_storage_account_key") - self._setup(storage_account_name, storage_account_key, secondary_storage_account_name, secondary_storage_account_key) + self._setup(storage_account_name, storage_account_key, secondary_storage_account_name, secondary_storage_account_key.secret) self._create_remote_share() source_file = self._create_remote_file() @@ -2473,7 +2473,7 @@ def test_copy_file_async_private_file(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=target_file_name, - credential=storage_account_key) + credential=storage_account_key.secret) with pytest.raises(HttpResponseError) as e: file_client.start_copy_from_url(source_file.url) @@ -2487,7 +2487,7 @@ def test_copy_file_async_private_file_with_sas(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") secondary_storage_account_name = kwargs.pop("secondary_storage_account_name") secondary_storage_account_key = kwargs.pop("secondary_storage_account_key") - self._setup(storage_account_name, storage_account_key, secondary_storage_account_name, secondary_storage_account_key) + self._setup(storage_account_name, storage_account_key, secondary_storage_account_name, secondary_storage_account_key.secret) data = b'12345678' * 1024 self._create_remote_share() source_file = self._create_remote_file(file_data=data) @@ -2508,7 +2508,7 @@ def test_copy_file_async_private_file_with_sas(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=target_file_name, - credential=storage_account_key) + credential=storage_account_key.secret) copy_resp = file_client.start_copy_from_url(source_url) # Assert @@ -2526,7 +2526,7 @@ def test_abort_copy_file(self, **kwargs): secondary_storage_account_name = kwargs.pop("secondary_storage_account_name") secondary_storage_account_key = kwargs.pop("secondary_storage_account_key") - self._setup(storage_account_name, storage_account_key, secondary_storage_account_name, secondary_storage_account_key) + self._setup(storage_account_name, storage_account_key, secondary_storage_account_name, secondary_storage_account_key.secret) data = b'12345678' * 1024 * 1024 self._create_remote_share() source_file = self._create_remote_file(file_data=data) @@ -2547,7 +2547,7 @@ def test_abort_copy_file(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=target_file_name, - credential=storage_account_key) + credential=storage_account_key.secret) copy_resp = file_client.start_copy_from_url(source_url) assert copy_resp['copy_status'] == 'pending' file_client.abort_copy(copy_resp) @@ -2567,7 +2567,7 @@ def test_abort_copy_file_with_oauth(self, **kwargs): token_credential = self.get_credential(ShareServiceClient) self._setup(storage_account_name, storage_account_key, secondary_storage_account_name, - secondary_storage_account_key) + secondary_storage_account_key.secret) data = b'12345678' * 1024 * 1024 self._create_remote_share() source_file = self._create_remote_file(file_data=data) @@ -2614,7 +2614,7 @@ def test_abort_copy_file_with_synchronous_copy_fails(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=target_file_name, - credential=storage_account_key) + credential=storage_account_key.secret) copy_resp = file_client.start_copy_from_url(source_file.url) with pytest.raises(HttpResponseError): @@ -2635,7 +2635,7 @@ def test_unicode_get_file_unicode_name(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) file_client.upload_file(b'hello world') # Act @@ -2656,7 +2656,7 @@ def test_unicode_get_file_unicode_name_with_lease(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) file_client.create_file(1024) lease = file_client.acquire_lease(lease_id='00000000-1111-2222-3333-444444444444') with pytest.raises(HttpResponseError): @@ -2686,7 +2686,7 @@ def test_file_unicode_data(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) # Act data = u'hello world啊齄丂狛狜'.encode('utf-8') @@ -2730,7 +2730,7 @@ def test_unicode_get_file_binary_data(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) file_client.upload_file(binary_data) # Act @@ -2752,7 +2752,7 @@ def test_create_file_from_bytes_with_progress(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024) # Act @@ -2785,7 +2785,7 @@ def test_create_file_from_bytes_with_index(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024) # Act @@ -2812,7 +2812,7 @@ def test_create_file_from_bytes_with_index_and_count(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024) # Act @@ -2837,7 +2837,7 @@ def test_create_file_from_path(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024) # Act @@ -2865,7 +2865,7 @@ def test_create_file_from_path_with_progress(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024) # Act @@ -2901,7 +2901,7 @@ def test_create_file_from_stream(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024) # Act @@ -2930,7 +2930,7 @@ def test_create_file_from_stream_non_seekable(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024) # Act @@ -2957,7 +2957,7 @@ def test_create_file_from_stream_with_progress(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024) # Act @@ -2991,7 +2991,7 @@ def test_create_file_from_stream_truncated(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024) # Act @@ -3017,7 +3017,7 @@ def test_create_file_from_stream_with_progress_truncated(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024) # Act @@ -3052,7 +3052,7 @@ def test_create_file_from_text(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024) # Act @@ -3075,7 +3075,7 @@ def test_create_file_from_text_with_encoding(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024) # Act @@ -3098,7 +3098,7 @@ def test_create_file_from_text_chunked_upload(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024) # Act @@ -3120,7 +3120,7 @@ def test_create_file_with_md5_small(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024) # Act @@ -3141,7 +3141,7 @@ def test_create_file_with_md5_large(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024) # Act @@ -3162,7 +3162,7 @@ def test_create_file_progress(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=1024) data = b'a' * 5 * 1024 @@ -3188,7 +3188,7 @@ def test_create_file_progress_parallel(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=1024) data = b'a' * 5 * 1024 @@ -3338,7 +3338,7 @@ def test_azure_named_key_credential_access(self, **kwargs): self._setup(storage_account_name, storage_account_key) file_client = self._create_file() - named_key = AzureNamedKeyCredential(storage_account_name, storage_account_key) + named_key = AzureNamedKeyCredential(storage_account_name, storage_account_key.secret) # Act file_client = ShareFileClient( @@ -3746,7 +3746,7 @@ def test_storage_account_audience_file_client(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key + credential=storage_account_key.secret ) file_client.create_file(1024) @@ -3781,7 +3781,7 @@ def test_bad_audience_file_client(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key + credential=storage_account_key.secret ) file_client.create_file(1024) @@ -3872,7 +3872,7 @@ def test_file_permission_format(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path='filecopy', - credential=storage_account_key + credential=storage_account_key.secret ) copy = file_client.start_copy_from_url( new_file.url, @@ -3898,7 +3898,7 @@ def test_legacy_transport(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path="filemocktransport", - credential=storage_account_key, + credential=storage_account_key.secret, transport=transport, retry_total=0 ) @@ -3928,7 +3928,7 @@ def test_legacy_transport_with_content_validation(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path="filemocktransport", - credential=storage_account_key, + credential=storage_account_key.secret, transport=transport, retry_total=0 ) @@ -3978,7 +3978,7 @@ def test_download_file_decompress(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024 ) compressed_data = b'\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcaH\xcd\xc9\xc9WH+\xca\xcfUH\xaf\xca,\x00\x00\x00\x00\xff\xff\x03\x00d\xaa\x8e\xb5\x0f\x00\x00\x00' @@ -4002,7 +4002,7 @@ def test_download_file_no_decompress_chunks(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_chunk_get_size=4, max_single_get_size=4, ) diff --git a/sdk/storage/azure-storage-file-share/tests/test_file_api_version.py b/sdk/storage/azure-storage-file-share/tests/test_file_api_version.py index 2a2e06ee7ffa..0f05f1543337 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_file_api_version.py +++ b/sdk/storage/azure-storage-file-share/tests/test_file_api_version.py @@ -184,7 +184,7 @@ def test_old_api_copy_file_succeeds(self, **kwargs): self.setUp() fsc = ShareServiceClient( self.account_url(storage_account_name, "file"), - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024, api_version=self.api_version_1 ) @@ -205,7 +205,7 @@ def test_old_api_copy_file_succeeds(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=share.share_name, file_path='file1copy', - credential=storage_account_key, + credential=storage_account_key.secret, api_version=self.api_version_1) # Act diff --git a/sdk/storage/azure-storage-file-share/tests/test_file_api_version_async.py b/sdk/storage/azure-storage-file-share/tests/test_file_api_version_async.py index 39109b2a6a40..bb347918073a 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_file_api_version_async.py +++ b/sdk/storage/azure-storage-file-share/tests/test_file_api_version_async.py @@ -185,7 +185,7 @@ async def test_old_api_copy_file_succeeds(self, **kwargs): fsc = ShareServiceClient( self.account_url(storage_account_name, "file"), - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024, api_version=self.api_version_1 ) @@ -206,7 +206,7 @@ async def test_old_api_copy_file_succeeds(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=share.share_name, file_path='file1copy', - credential=storage_account_key, + credential=storage_account_key.secret, api_version=self.api_version_1) # Act diff --git a/sdk/storage/azure-storage-file-share/tests/test_file_async.py b/sdk/storage/azure-storage-file-share/tests/test_file_async.py index e3500d16191f..6d4d0d56426d 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_file_async.py +++ b/sdk/storage/azure-storage-file-share/tests/test_file_async.py @@ -58,8 +58,8 @@ def _setup(self, storage_account_name, storage_account_key, rmt_account=None, rm # for chunking and the size of each chunk, otherwise # the tests would take too long to execute self.fsc = ShareServiceClient( - url, credential=credential, max_range_size=4 * 1024) - self.bsc = BlobServiceClient(blob_url, credential=credential) + url, credential=credential.secret, max_range_size=4 * 1024) + self.bsc = BlobServiceClient(blob_url, credential=credential.secret) self.source_container_name = self.get_resource_name('sourceshare') self.share_name = self.get_resource_name('utshare') self.short_byte_data = self.get_random_bytes(1024) @@ -94,7 +94,7 @@ async def _setup_share(self, storage_account_name, storage_account_key, remote=F share_name = self.remote_share_name if remote else self.share_name async with ShareServiceClient( self.account_url(storage_account_name, "file"), - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024) as fsc: if not self.is_playback(): try: @@ -213,7 +213,7 @@ async def test_make_file_url_with_protocol(self, **kwargs): self._setup(storage_account_name, storage_account_key) url = self.account_url(storage_account_name, "file").replace('https', 'http') - fsc = ShareServiceClient(url, credential=storage_account_key) + fsc = ShareServiceClient(url, credential=storage_account_key.secret) share = fsc.get_share_client("vhds") file_client = share.get_file_client("vhd_dir/my.vhd") @@ -258,7 +258,7 @@ async def test_exists(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) as file_client: + credential=storage_account_key.secret) as file_client: # Act / Assert assert not await file_client.exists() @@ -279,7 +279,7 @@ async def test_create_file(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) as file_client: + credential=storage_account_key.secret) as file_client: # Act resp = await file_client.create_file(1024) @@ -348,7 +348,7 @@ async def test_create_file_with_trailing_dot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + '.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True) as file_client: # Act resp = await file_client.create_file(1024) @@ -373,7 +373,7 @@ async def test_create_file_with_trailing_dot_false(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + '.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=False) # Act @@ -384,7 +384,7 @@ async def test_create_file_with_trailing_dot_false(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + '.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=False) # create file client without dot @@ -392,7 +392,7 @@ async def test_create_file_with_trailing_dot_false(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=False) props = await file_client.get_file_properties() @@ -421,7 +421,7 @@ async def test_create_file_with_metadata(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) as file_client: + credential=storage_account_key.secret) as file_client: # Act resp = await file_client.create_file(1024, metadata=metadata) @@ -447,7 +447,7 @@ async def test_create_file_with_metadata_with_trailing_dot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + '.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True) as file_client: # Act resp = await file_client.create_file(1024, metadata=metadata) @@ -498,7 +498,7 @@ async def test_create_file_semantics(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + "file1", - credential=storage_account_key + credential=storage_account_key.secret ) await file1.create_file(1024, file_property_semantics=None) props = await file1.get_file_properties() @@ -508,7 +508,7 @@ async def test_create_file_semantics(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + "file2", - credential=storage_account_key + credential=storage_account_key.secret ) await file2.create_file(1024, file_property_semantics="New") props = await file2.get_file_properties() @@ -518,7 +518,7 @@ async def test_create_file_semantics(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + "file2", - credential=storage_account_key + credential=storage_account_key.secret ) await file3.create_file(1024, file_property_semantics="Restore", file_permission=TEST_FILE_PERMISSIONS) props = await file3.get_file_properties() @@ -641,7 +641,7 @@ async def test_lease_operations_trailing_dot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + '.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True) await file_client.create_file(1024) @@ -770,7 +770,7 @@ async def test_file_not_exists(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path="missingdir/" + file_name, - credential=storage_account_key) + credential=storage_account_key.secret) # Act with pytest.raises(ResourceNotFoundError): @@ -794,7 +794,7 @@ async def test_file_exists_with_snapshot(self, **kwargs): share_name=self.share_name, file_path=file_client.file_name, snapshot=snapshot, - credential=storage_account_key) + credential=storage_account_key.secret) props = await snapshot_client.get_file_properties() # Assert @@ -819,7 +819,7 @@ async def test_file_not_exists_with_snapshot(self, **kwargs): share_name=self.share_name, file_path=file_client.file_name, snapshot=snapshot, - credential=storage_account_key) + credential=storage_account_key.secret) # Assert with pytest.raises(ResourceNotFoundError): @@ -929,7 +929,7 @@ async def test_set_file_properties_trailing_dot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + '.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True) await file_client.create_file(1024) @@ -1069,7 +1069,7 @@ async def test_get_file_properties_trailing_dot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + '.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True) await file_client.create_file(1024) @@ -1078,7 +1078,7 @@ async def test_get_file_properties_trailing_dot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) with pytest.raises(HttpResponseError): await file_client_no_dot.get_file_properties() @@ -1133,7 +1133,7 @@ async def test_get_file_properties_with_snapshot(self, **kwargs): share_name=self.share_name, file_path=file_client.file_name, snapshot=snapshot, - credential=storage_account_key) + credential=storage_account_key.secret) snapshot_props = await snapshot_client.get_file_properties() # Assert assert file_props is not None @@ -1159,7 +1159,7 @@ async def test_get_file_metadata_with_snapshot(self, **kwargs): share_name=self.share_name, file_path=file_client.file_name, snapshot=snapshot, - credential=storage_account_key) + credential=storage_account_key.secret) metadata2 = {"test100": "foo100", "test200": "bar200"} await file_client.set_file_metadata(metadata2) @@ -1184,7 +1184,7 @@ async def test_get_file_properties_with_non_existing_file(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) # Act with pytest.raises(ResourceNotFoundError): @@ -1367,7 +1367,7 @@ async def test_delete_file_with_existing_file_trailing_dot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + '.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True) await file_client.create_file(1024) @@ -1390,7 +1390,7 @@ async def test_delete_file_with_non_existing_file(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) # Act with pytest.raises(ResourceNotFoundError): @@ -1457,7 +1457,7 @@ async def test_update_range_trailing_dot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + '.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True) await file_client.upload_file(self.short_byte_data) @@ -1827,7 +1827,7 @@ async def test_clear_range_trailing_dot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + '.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True) await file_client.upload_file(self.short_byte_data) @@ -1878,7 +1878,7 @@ async def test_list_ranges_none(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) await file_client.create_file(1024) # Act @@ -1901,7 +1901,7 @@ async def test_list_ranges_none_trailing_dot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + '.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True) await file_client.create_file(1024) @@ -1927,7 +1927,7 @@ async def test_list_ranges_none_with_invalid_lease_fails(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) await file_client.create_file(1024) await file_client.acquire_lease(lease_id='00000000-1111-2222-3333-444444444444') @@ -1955,7 +1955,7 @@ async def test_list_ranges_diff(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) await file_client.create_file(2048) share_client = self.fsc.get_share_client(self.share_name) @@ -2053,7 +2053,7 @@ async def test_list_ranges_diff_trailing_dot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + '.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True) await file_client.create_file(2048) @@ -2105,7 +2105,7 @@ async def test_list_ranges_diff_support_rename(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) await file_client.create_file(2048) share_client = self.fsc.get_share_client(self.share_name) @@ -2145,7 +2145,7 @@ async def test_list_ranges_2(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) await file_client.create_file(2048) data = b'abcdefghijklmnop' * 32 @@ -2176,7 +2176,7 @@ async def test_list_ranges_none_from_snapshot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) await file_client.create_file(1024) share_client = self.fsc.get_share_client(self.share_name) @@ -2186,7 +2186,7 @@ async def test_list_ranges_none_from_snapshot(self, **kwargs): share_name=self.share_name, file_path=file_client.file_name, snapshot=snapshot, - credential=storage_account_key) + credential=storage_account_key.secret) await file_client.delete_file() @@ -2247,7 +2247,7 @@ async def test_list_ranges_2_from_snapshot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) await file_client.create_file(2048) data = b'abcdefghijklmnop' * 32 resp1 = await file_client.upload_range(data, offset=0, length=512) @@ -2260,7 +2260,7 @@ async def test_list_ranges_2_from_snapshot(self, **kwargs): share_name=self.share_name, file_path=file_client.file_name, snapshot=snapshot, - credential=storage_account_key) + credential=storage_account_key.secret) await file_client.delete_file() @@ -2287,7 +2287,7 @@ async def test_copy_file_with_existing_file(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path='file1copy', - credential=storage_account_key) + credential=storage_account_key.secret) # Act copy = await file_client.start_copy_from_url(source_client.url) @@ -2342,7 +2342,7 @@ async def test_copy_file_with_existing_file_trailing_dot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name + '.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True, allow_source_trailing_dot=True) await source_client.upload_file(self.short_byte_data) @@ -2351,7 +2351,7 @@ async def test_copy_file_with_existing_file_trailing_dot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path='file1copy.', - credential=storage_account_key, + credential=storage_account_key.secret, allow_trailing_dot=True, allow_source_trailing_dot=True) @@ -2367,7 +2367,7 @@ async def test_copy_existing_file_with_lease(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path='file1copy', - credential=storage_account_key) + credential=storage_account_key.secret) await file_client.create_file(1024) lease = await file_client.acquire_lease(lease_id='00000000-1111-2222-3333-444444444444') @@ -2398,7 +2398,7 @@ async def test_copy_file_ignore_readonly(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path='file1copy', - credential=storage_account_key) + credential=storage_account_key.secret) file_attributes = NTFSAttributes(read_only=True) await dest_file.create_file(1024, file_attributes=file_attributes) @@ -2430,7 +2430,7 @@ async def test_copy_file_with_specifying_acl_copy_behavior_attributes(self, **kw self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path='file1copy', - credential=storage_account_key) + credential=storage_account_key.secret) source_props = await source_client.get_file_properties() file_creation_time = source_props.creation_time - timedelta(hours=1) @@ -2479,7 +2479,7 @@ async def test_copy_file_with_specifying_acl_and_attributes_from_source(self, ** self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path='file1copy', - credential=storage_account_key) + credential=storage_account_key.secret) # Act copy = await file_client.start_copy_from_url( @@ -2508,7 +2508,7 @@ async def test_copy_file_async_private_file_async(self, **kwargs): secondary_storage_account_name = kwargs.pop("secondary_storage_account_name") secondary_storage_account_key = kwargs.pop("secondary_storage_account_key") - self._setup(storage_account_name, storage_account_key, secondary_storage_account_name, secondary_storage_account_key) + self._setup(storage_account_name, storage_account_key, secondary_storage_account_name, secondary_storage_account_key.secret) await self._setup_share(storage_account_name, storage_account_key) await self._create_remote_share() source_file = await self._create_remote_file() @@ -2519,7 +2519,7 @@ async def test_copy_file_async_private_file_async(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=target_file_name, - credential=storage_account_key) + credential=storage_account_key.secret) with pytest.raises(HttpResponseError) as e: await file_client.start_copy_from_url(source_file.url) @@ -2535,7 +2535,7 @@ async def test_copy_file_async_private_file_with_sas_async(self, **kwargs): secondary_storage_account_name = kwargs.pop("secondary_storage_account_name") secondary_storage_account_key = kwargs.pop("secondary_storage_account_key") - self._setup(storage_account_name, storage_account_key, secondary_storage_account_name, secondary_storage_account_key) + self._setup(storage_account_name, storage_account_key, secondary_storage_account_name, secondary_storage_account_key.secret) data = b'12345678' * 1024 await self._create_remote_share() source_file = await self._create_remote_file(file_data=data) @@ -2557,7 +2557,7 @@ async def test_copy_file_async_private_file_with_sas_async(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=target_file_name, - credential=storage_account_key) + credential=storage_account_key.secret) copy_resp = await file_client.start_copy_from_url(source_url) # Assert @@ -2576,7 +2576,7 @@ async def test_abort_copy_file_async(self, **kwargs): secondary_storage_account_name = kwargs.pop("secondary_storage_account_name") secondary_storage_account_key = kwargs.pop("secondary_storage_account_key") - self._setup(storage_account_name, storage_account_key, secondary_storage_account_name, secondary_storage_account_key) + self._setup(storage_account_name, storage_account_key, secondary_storage_account_name, secondary_storage_account_key.secret) data = b'12345678' * 1024 * 1024 await self._setup_share(storage_account_name, storage_account_key) await self._create_remote_share() @@ -2598,7 +2598,7 @@ async def test_abort_copy_file_async(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=target_file_name, - credential=storage_account_key) + credential=storage_account_key.secret) copy_resp = await file_client.start_copy_from_url(source_url) assert copy_resp['copy_status'] == 'pending' await file_client.abort_copy(copy_resp) @@ -2618,7 +2618,7 @@ async def test_abort_copy_file_async_with_oauth(self, **kwargs): secondary_storage_account_key = kwargs.pop("secondary_storage_account_key") token_credential = self.get_credential(ShareServiceClient, is_async=True) - self._setup(storage_account_name, storage_account_key, secondary_storage_account_name, secondary_storage_account_key) + self._setup(storage_account_name, storage_account_key, secondary_storage_account_name, secondary_storage_account_key.secret) data = b'12345678' * 1024 * 1024 await self._setup_share(storage_account_name, storage_account_key) await self._create_remote_share() @@ -2667,7 +2667,7 @@ async def test_abort_copy_file_with_synchronous_copy_fails(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=target_file_name, - credential=storage_account_key) + credential=storage_account_key.secret) copy_resp = await file_client.start_copy_from_url(source_file.url) with pytest.raises(HttpResponseError): @@ -2689,7 +2689,7 @@ async def test_unicode_get_file_unicode_name(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) await file_client.upload_file(b'hello world') # Act @@ -2712,7 +2712,7 @@ async def test_unicode_get_file_unicode_name_with_lease(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) await file_client.create_file(1024) lease = await file_client.acquire_lease(lease_id='00000000-1111-2222-3333-444444444444') @@ -2745,7 +2745,7 @@ async def test_file_unicode_data(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) # Act data = u'hello world啊齄丂狛狜'.encode('utf-8') @@ -2792,7 +2792,7 @@ async def test_unicode_get_file_binary_data(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) await file_client.upload_file(binary_data) # Act @@ -2816,7 +2816,7 @@ async def test_create_file_from_bytes_with_progress(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024) # Act @@ -2847,7 +2847,7 @@ async def test_create_file_from_bytes_with_index(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024) # Act @@ -2875,7 +2875,7 @@ async def test_create_file_from_bytes_with_index_and_count(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024) # Act @@ -2901,7 +2901,7 @@ async def test_create_file_from_path(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024) # Act @@ -2930,7 +2930,7 @@ async def test_create_file_from_path_with_progress(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024) # Act @@ -2967,7 +2967,7 @@ async def test_create_file_from_stream(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024) # Act @@ -2997,7 +2997,7 @@ async def test_create_file_from_stream_non_seekable(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024) # Act @@ -3025,7 +3025,7 @@ async def test_create_file_from_stream_with_progress(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024) # Act @@ -3060,7 +3060,7 @@ async def test_create_file_from_stream_truncated(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024) # Act @@ -3087,7 +3087,7 @@ async def test_create_file_from_stream_with_progress_truncated(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024) # Act @@ -3128,7 +3128,7 @@ async def data_generator(): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) + credential=storage_account_key.secret) # Act file_size = len(data*3) @@ -3152,7 +3152,7 @@ async def test_create_file_from_text(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024) # Act @@ -3176,7 +3176,7 @@ async def test_create_file_from_text_with_encoding(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024) # Act @@ -3201,7 +3201,7 @@ async def test_create_file_from_text_chunked_upload(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024) # Act @@ -3225,7 +3225,7 @@ async def test_create_file_with_md5_small(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024) # Act @@ -3247,7 +3247,7 @@ async def test_create_file_with_md5_large(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024) # Act @@ -3269,7 +3269,7 @@ async def test_create_file_progress(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=1024) data = b'a' * 5 * 1024 @@ -3296,7 +3296,7 @@ async def test_create_file_progress_parallel(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=1024) data = b'a' * 5 * 1024 @@ -3448,7 +3448,7 @@ async def test_azure_named_key_credential_access(self, **kwargs): self._setup(storage_account_name, storage_account_key) file_client = await self._create_file(storage_account_name, storage_account_key) - named_key = AzureNamedKeyCredential(storage_account_name, storage_account_key) + named_key = AzureNamedKeyCredential(storage_account_name, storage_account_key.secret) # Act file_client = ShareFileClient( @@ -3637,7 +3637,7 @@ async def test_rename_file_with_oauth(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key) as file_client: + credential=storage_account_key.secret) as file_client: # Act resp = await file_client.create_file(1024) new_file = await file_client.rename_file('file2') @@ -3862,7 +3862,7 @@ async def test_storage_account_audience_file_client(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key + credential=storage_account_key.secret ) await file_client.create_file(1024) @@ -3898,7 +3898,7 @@ async def test_bad_audience_file_client(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key + credential=storage_account_key.secret ) await file_client.create_file(1024) @@ -3987,7 +3987,7 @@ async def test_file_permission_format(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path='filecopy', - credential=storage_account_key + credential=storage_account_key.secret ) copy = await file_client.start_copy_from_url( new_file.url, @@ -4013,7 +4013,7 @@ async def test_legacy_transport(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path="filemocktransport", - credential=storage_account_key, + credential=storage_account_key.secret, transport=transport, retry_total=0 ) @@ -4044,7 +4044,7 @@ async def test_legacy_transport_with_content_validation(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path="filemocktransport", - credential=storage_account_key, + credential=storage_account_key.secret, transport=transport, retry_total=0 ) @@ -4104,7 +4104,7 @@ async def test_download_file_decompress(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_range_size=4 * 1024 ) compressed_data = b'\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcaH\xcd\xc9\xc9WH+\xca\xcfUH\xaf\xca,\x00\x00\x00\x00\xff\xff\x03\x00d\xaa\x8e\xb5\x0f\x00\x00\x00' @@ -4129,7 +4129,7 @@ async def test_download_file_no_decompress_chunks(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_chunk_get_size=4, max_single_get_size=4, ) diff --git a/sdk/storage/azure-storage-file-share/tests/test_file_client.py b/sdk/storage/azure-storage-file-share/tests/test_file_client.py index 84e87748b23f..df8a607f27f8 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_file_client.py +++ b/sdk/storage/azure-storage-file-share/tests/test_file_client.py @@ -46,7 +46,7 @@ def validate_standard_account_endpoints(self, service, service_type, protocol='h assert service is not None assert service.account_name == self.account_name assert service.credential.account_name == self.account_name - assert service.credential.account_key == self.account_key + assert service.credential.account_key == self.account_key.secret assert service.primary_endpoint.startswith('{}://{}.{}.core.windows.net/'.format(protocol, self.account_name, service_type)) is True assert service.secondary_endpoint.startswith('{}://{}-secondary.{}.core.windows.net/'.format(protocol, self.account_name, service_type)) is True @@ -61,7 +61,7 @@ def test_create_service_with_key(self, **kwargs): for client, url in SERVICES.items(): # Act service = client( - self.account_url(storage_account_name, "file"), credential=self.account_key, + self.account_url(storage_account_name, "file"), credential=self.account_key.secret, share_name='foo', directory_path='bar', file_path='baz') # Assert @@ -113,14 +113,14 @@ def test_create_service_china(self, **kwargs): for service_type in SERVICES.items(): # Act service = service_type[0]( - url, credential=self.account_key, + url, credential=self.account_key.secret, share_name='foo', directory_path='bar', file_path='baz') # Assert assert service is not None assert service.account_name == self.account_name assert service.credential.account_name == self.account_name - assert service.credential.account_key == self.account_key + assert service.credential.account_key == self.account_key.secret assert service.primary_hostname == '{}.{}.core.chinacloudapi.cn'.format(self.account_name, service_type[1]) assert service.secondary_hostname == '{}-secondary.{}.core.chinacloudapi.cn'.format(self.account_name, service_type[1]) @@ -134,7 +134,7 @@ def test_create_service_protocol(self, **kwargs): for service_type in SERVICES.items(): # Act service = service_type[0]( - url, credential=self.account_key, share_name='foo', directory_path='bar', file_path='baz') + url, credential=self.account_key.secret, share_name='foo', directory_path='bar', file_path='baz') # Assert self.validate_standard_account_endpoints(service, service_type[1], protocol='http') @@ -165,10 +165,10 @@ def test_create_service_with_socket_timeout(self, **kwargs): for service_type in SERVICES.items(): # Act default_service = service_type[0]( - self.account_url(storage_account_name, "file"), credential=self.account_key, + self.account_url(storage_account_name, "file"), credential=self.account_key.secret, share_name='foo', directory_path='bar', file_path='baz') service = service_type[0]( - self.account_url(storage_account_name, "file"), credential=self.account_key, connection_timeout=22, + self.account_url(storage_account_name, "file"), credential=self.account_key.secret, connection_timeout=22, share_name='foo', directory_path='bar', file_path='baz') # Assert @@ -184,7 +184,7 @@ def test_create_service_with_connection_string_key(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") self._setup(storage_account_name, storage_account_key) - conn_string = 'AccountName={};AccountKey={};'.format(self.account_name, self.account_key) + conn_string = 'AccountName={};AccountKey={};'.format(self.account_name, self.account_key.secret) for service_type in SERVICES.items(): # Act @@ -221,7 +221,7 @@ def test_create_service_with_connection_string_endpoint_protocol(self, **kwargs) self._setup(storage_account_name, storage_account_key) conn_string = 'AccountName={};AccountKey={};DefaultEndpointsProtocol=http;EndpointSuffix=core.chinacloudapi.cn;'.format( - self.account_name, self.account_key) + self.account_name, self.account_key.secret) for service_type in SERVICES.items(): # Act @@ -232,7 +232,7 @@ def test_create_service_with_connection_string_endpoint_protocol(self, **kwargs) assert service is not None assert service.account_name == self.account_name assert service.credential.account_name == self.account_name - assert service.credential.account_key == self.account_key + assert service.credential.account_key == self.account_key.secret assert service.primary_hostname, '{}.{}.core.chinacloudapi.cn'.format(self.account_name == service_type[1]) assert service.secondary_hostname == '{}-secondary.{}.core.chinacloudapi.cn'.format(self.account_name, service_type[1]) assert service.scheme == 'http' @@ -259,7 +259,7 @@ def test_create_service_with_connection_string_fails_if_secondary_without_primar for service_type in SERVICES.items(): self._setup(storage_account_name, storage_account_key) conn_string = 'AccountName={};AccountKey={};{}=www.mydomain.com;'.format( - self.account_name, self.account_key, _CONNECTION_ENDPOINTS_SECONDARY.get(service_type[1])) + self.account_name, self.account_key.secret, _CONNECTION_ENDPOINTS_SECONDARY.get(service_type[1])) # Act @@ -276,7 +276,7 @@ def test_create_service_with_connection_string_succeeds_if_secondary_with_primar for service_type in SERVICES.items(): self._setup(storage_account_name, storage_account_key) conn_string = 'AccountName={};AccountKey={};{}=www.mydomain.com;{}=www-sec.mydomain.com;'.format( - self.account_name, self.account_key, + self.account_name, self.account_key.secret, _CONNECTION_ENDPOINTS.get(service_type[1]), _CONNECTION_ENDPOINTS_SECONDARY.get(service_type[1])) @@ -288,7 +288,7 @@ def test_create_service_with_connection_string_succeeds_if_secondary_with_primar assert service is not None assert service.account_name == self.account_name assert service.credential.account_name == self.account_name - assert service.credential.account_key == self.account_key + assert service.credential.account_key == self.account_key.secret assert service.primary_hostname == 'www.mydomain.com' assert service.secondary_hostname == 'www-sec.mydomain.com' @@ -301,7 +301,7 @@ def test_create_service_with_custom_account_endpoint_path(self, **kwargs): custom_account_url = "http://local-machine:11002/custom/account/path/" + self.sas_token for service_type in SERVICES.items(): conn_string = 'DefaultEndpointsProtocol=http;AccountName={};AccountKey={};FileEndpoint={};'.format( - self.account_name, self.account_key, custom_account_url) + self.account_name, self.account_key.secret, custom_account_url) # Act service = service_type[0].from_connection_string( @@ -310,7 +310,7 @@ def test_create_service_with_custom_account_endpoint_path(self, **kwargs): # Assert assert service.account_name == self.account_name assert service.credential.account_name == self.account_name - assert service.credential.account_key == self.account_key + assert service.credential.account_key == self.account_key.secret assert service.primary_hostname == 'local-machine:11002/custom/account/path' service = ShareServiceClient(account_url=custom_account_url) @@ -375,7 +375,7 @@ def test_client_request_id_echo(self, **kwargs): self._setup(storage_account_name, storage_account_key) request_id_header_name = 'x-ms-client-request-id' - service = ShareServiceClient(self.account_url(storage_account_name, "file"), credential=self.account_key) + service = ShareServiceClient(self.account_url(storage_account_name, "file"), credential=self.account_key.secret) # Act make the client request ID slightly different def callback(response): @@ -401,7 +401,7 @@ def test_user_agent_default(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") self._setup(storage_account_name, storage_account_key) - service = ShareServiceClient(self.account_url(storage_account_name, "file"), credential=self.account_key) + service = ShareServiceClient(self.account_url(storage_account_name, "file"), credential=self.account_key.secret) def callback(response): assert 'User-Agent' in response.http_request.headers @@ -418,7 +418,7 @@ def test_user_agent_custom(self, **kwargs): self._setup(storage_account_name, storage_account_key) custom_app = "TestApp/v1.0" service = ShareServiceClient( - self.account_url(storage_account_name, "file"), credential=self.account_key, user_agent=custom_app) + self.account_url(storage_account_name, "file"), credential=self.account_key.secret, user_agent=custom_app) def callback1(response): assert 'User-Agent' in response.http_request.headers @@ -445,7 +445,7 @@ def test_user_agent_append(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") self._setup(storage_account_name, storage_account_key) - service = ShareServiceClient(self.account_url(storage_account_name, "file"), credential=self.account_key) + service = ShareServiceClient(self.account_url(storage_account_name, "file"), credential=self.account_key.secret) def callback(response): assert 'User-Agent' in response.http_request.headers @@ -484,7 +484,7 @@ def test_closing_pipeline_client(self, **kwargs): for client, url in SERVICES.items(): # Act service = client( - self.account_url(storage_account_name, "file"), credential=self.account_key, share_name='foo', directory_path='bar', file_path='baz') + self.account_url(storage_account_name, "file"), credential=self.account_key.secret, share_name='foo', directory_path='bar', file_path='baz') # Assert with service: @@ -501,6 +501,6 @@ def test_closing_pipeline_client_simple(self, **kwargs): for client, url in SERVICES.items(): # Act service = client( - self.account_url(storage_account_name, "file"), credential=self.account_key, share_name='foo', directory_path='bar', file_path='baz') + self.account_url(storage_account_name, "file"), credential=self.account_key.secret, share_name='foo', directory_path='bar', file_path='baz') service.close() diff --git a/sdk/storage/azure-storage-file-share/tests/test_file_client_async.py b/sdk/storage/azure-storage-file-share/tests/test_file_client_async.py index c3f86e1557f6..bd2dac98405b 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_file_client_async.py +++ b/sdk/storage/azure-storage-file-share/tests/test_file_client_async.py @@ -47,7 +47,7 @@ def validate_standard_account_endpoints(self, service, service_type, protocol='h assert service is not None assert service.account_name == self.account_name assert service.credential.account_name == self.account_name - assert service.credential.account_key == self.account_key + assert service.credential.account_key == self.account_key.secret assert service.primary_endpoint.startswith('{}://{}.{}.core.windows.net/'.format(protocol, self.account_name, service_type)) is True assert service.secondary_endpoint.startswith('{}://{}-secondary.{}.core.windows.net/'.format(protocol, self.account_name, service_type)) is True @@ -62,7 +62,7 @@ async def test_create_service_with_key(self, **kwargs): for client, url in SERVICES.items(): # Act service = client( - self.account_url(storage_account_name, "file"), credential=self.account_key, + self.account_url(storage_account_name, "file"), credential=self.account_key.secret, share_name='foo', directory_path='bar', file_path='baz') # Assert @@ -113,14 +113,14 @@ async def test_create_service_china(self, **kwargs): for service_type in SERVICES.items(): # Act service = service_type[0]( - url, credential=self.account_key, + url, credential=self.account_key.secret, share_name='foo', directory_path='bar', file_path='baz') # Assert assert service is not None assert service.account_name == self.account_name assert service.credential.account_name == self.account_name - assert service.credential.account_key == self.account_key + assert service.credential.account_key == self.account_key.secret assert service.primary_hostname == '{}.{}.core.chinacloudapi.cn'.format(self.account_name, service_type[1]) assert service.secondary_hostname == '{}-secondary.{}.core.chinacloudapi.cn'.format(self.account_name, service_type[1]) @@ -134,7 +134,7 @@ async def test_create_service_protocol(self, **kwargs): for service_type in SERVICES.items(): # Act service = service_type[0]( - url, credential=self.account_key, share_name='foo', directory_path='bar', file_path='baz') + url, credential=self.account_key.secret, share_name='foo', directory_path='bar', file_path='baz') # Assert self.validate_standard_account_endpoints(service, service_type[1], protocol='http') @@ -165,10 +165,10 @@ async def test_create_service_with_socket_timeout(self, **kwargs): for service_type in SERVICES.items(): # Act default_service = service_type[0]( - self.account_url(storage_account_name, "file"), credential=self.account_key, + self.account_url(storage_account_name, "file"), credential=self.account_key.secret, share_name='foo', directory_path='bar', file_path='baz') service = service_type[0]( - self.account_url(storage_account_name, "file"), credential=self.account_key, connection_timeout=22, + self.account_url(storage_account_name, "file"), credential=self.account_key.secret, connection_timeout=22, share_name='foo', directory_path='bar', file_path='baz') # Assert @@ -184,7 +184,7 @@ async def test_create_service_with_connection_string_key(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") self._setup(storage_account_name, storage_account_key) - conn_string = 'AccountName={};AccountKey={};'.format(self.account_name, self.account_key) + conn_string = 'AccountName={};AccountKey={};'.format(self.account_name, self.account_key.secret) for service_type in SERVICES.items(): # Act @@ -221,7 +221,7 @@ async def test_create_service_with_connection_string_endpoint_protocol(self, **k self._setup(storage_account_name, storage_account_key) conn_string = 'AccountName={};AccountKey={};DefaultEndpointsProtocol=http;EndpointSuffix=core.chinacloudapi.cn;'.format( - self.account_name, self.account_key) + self.account_name, self.account_key.secret) for service_type in SERVICES.items(): # Act @@ -231,7 +231,7 @@ async def test_create_service_with_connection_string_endpoint_protocol(self, **k assert service is not None assert service.account_name == self.account_name assert service.credential.account_name == self.account_name - assert service.credential.account_key == self.account_key + assert service.credential.account_key == self.account_key.secret assert service.primary_hostname == '{}.{}.core.chinacloudapi.cn'.format(self.account_name, service_type[1]) assert service.secondary_hostname == '{}-secondary.{}.core.chinacloudapi.cn'.format(self.account_name, service_type[1]) assert service.scheme == 'http' @@ -257,7 +257,7 @@ async def test_create_service_with_connection_string_fails_if_secondary_without_ for service_type in SERVICES.items(): self._setup(storage_account_name, storage_account_key) conn_string = 'AccountName={};AccountKey={};{}=www.mydomain.com;'.format( - self.account_name, self.account_key, _CONNECTION_ENDPOINTS_SECONDARY.get(service_type[1])) + self.account_name, self.account_key.secret, _CONNECTION_ENDPOINTS_SECONDARY.get(service_type[1])) # Act @@ -274,7 +274,7 @@ async def test_create_service_with_connection_string_succeeds_if_secondary_with_ for service_type in SERVICES.items(): self._setup(storage_account_name, storage_account_key) conn_string = 'AccountName={};AccountKey={};{}=www.mydomain.com;{}=www-sec.mydomain.com;'.format( - self.account_name, self.account_key, + self.account_name, self.account_key.secret, _CONNECTION_ENDPOINTS.get(service_type[1]), _CONNECTION_ENDPOINTS_SECONDARY.get(service_type[1])) @@ -286,7 +286,7 @@ async def test_create_service_with_connection_string_succeeds_if_secondary_with_ assert service is not None assert service.account_name == self.account_name assert service.credential.account_name == self.account_name - assert service.credential.account_key == self.account_key + assert service.credential.account_key == self.account_key.secret assert service.primary_hostname == 'www.mydomain.com' assert service.secondary_hostname == 'www-sec.mydomain.com' @@ -299,7 +299,7 @@ async def test_create_service_with_custom_account_endpoint_path(self, **kwargs): custom_account_url = "http://local-machine:11002/custom/account/path/" + self.sas_token for service_type in SERVICES.items(): conn_string = 'DefaultEndpointsProtocol=http;AccountName={};AccountKey={};FileEndpoint={};'.format( - self.account_name, self.account_key, custom_account_url) + self.account_name, self.account_key.secret, custom_account_url) # Act service = service_type[0].from_connection_string( @@ -308,7 +308,7 @@ async def test_create_service_with_custom_account_endpoint_path(self, **kwargs): # Assert assert service.account_name == self.account_name assert service.credential.account_name == self.account_name - assert service.credential.account_key == self.account_key + assert service.credential.account_key == self.account_key.secret assert service.primary_hostname == 'local-machine:11002/custom/account/path' service = ShareServiceClient(account_url=custom_account_url) @@ -372,7 +372,7 @@ async def test_user_agent_default(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") self._setup(storage_account_name, storage_account_key) - service = ShareServiceClient(self.account_url(storage_account_name, "file"), credential=self.account_key) + service = ShareServiceClient(self.account_url(storage_account_name, "file"), credential=self.account_key.secret) def callback(response): assert 'User-Agent' in response.http_request.headers @@ -389,7 +389,7 @@ async def test_user_agent_custom(self, **kwargs): self._setup(storage_account_name, storage_account_key) custom_app = "TestApp/v1.0" service = ShareServiceClient( - self.account_url(storage_account_name, "file"), credential=self.account_key, user_agent=custom_app) + self.account_url(storage_account_name, "file"), credential=self.account_key.secret, user_agent=custom_app) def callback1(response): assert 'User-Agent' in response.http_request.headers @@ -416,7 +416,7 @@ async def test_user_agent_append(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") self._setup(storage_account_name, storage_account_key) - service = ShareServiceClient(self.account_url(storage_account_name, "file"), credential=self.account_key) + service = ShareServiceClient(self.account_url(storage_account_name, "file"), credential=self.account_key.secret) def callback(response): assert 'User-Agent' in response.http_request.headers @@ -437,7 +437,7 @@ async def test_closing_pipeline_client(self, **kwargs): for client, url in SERVICES.items(): # Act service = client( - self.account_url(storage_account_name, "file"), credential=self.account_key, share_name='foo', directory_path='bar', file_path='baz') + self.account_url(storage_account_name, "file"), credential=self.account_key.secret, share_name='foo', directory_path='bar', file_path='baz') # Assert async with service: @@ -454,7 +454,7 @@ async def test_closing_pipeline_client_simple(self, **kwargs): for client, url in SERVICES.items(): # Act service = client( - self.account_url(storage_account_name, "file"), credential=self.account_key, share_name='foo', directory_path='bar', file_path='baz') + self.account_url(storage_account_name, "file"), credential=self.account_key.secret, share_name='foo', directory_path='bar', file_path='baz') await service.close() diff --git a/sdk/storage/azure-storage-file-share/tests/test_file_service_properties.py b/sdk/storage/azure-storage-file-share/tests/test_file_service_properties.py index 3ad4f007c4d8..5681e5181e52 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_file_service_properties.py +++ b/sdk/storage/azure-storage-file-share/tests/test_file_service_properties.py @@ -29,7 +29,7 @@ class TestFileServiceProperties(StorageRecordedTestCase): def _setup(self, storage_account_name, storage_account_key): url = self.account_url(storage_account_name, "file") credential = storage_account_key - self.fsc = ShareServiceClient(url, credential=credential) + self.fsc = ShareServiceClient(url, credential=credential.secret) def _teardown(self, FILE_PATH): if os.path.isfile(FILE_PATH): diff --git a/sdk/storage/azure-storage-file-share/tests/test_file_service_properties_async.py b/sdk/storage/azure-storage-file-share/tests/test_file_service_properties_async.py index 9305d2917363..ef369db70060 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_file_service_properties_async.py +++ b/sdk/storage/azure-storage-file-share/tests/test_file_service_properties_async.py @@ -32,7 +32,7 @@ class TestFileServicePropertiesAsync(AsyncStorageRecordedTestCase): def _setup(self, storage_account_name, storage_account_key): url = self.account_url(storage_account_name, "file") credential = storage_account_key - self.fsc = ShareServiceClient(url, credential=credential) + self.fsc = ShareServiceClient(url, credential=credential.secret) def _teardown(self, FILE_PATH): if os.path.isfile(FILE_PATH): diff --git a/sdk/storage/azure-storage-file-share/tests/test_get_file.py b/sdk/storage/azure-storage-file-share/tests/test_get_file.py index 6e6fd20600df..59362970ae2a 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_get_file.py +++ b/sdk/storage/azure-storage-file-share/tests/test_get_file.py @@ -35,7 +35,7 @@ def _setup(self, storage_account_name, storage_account_key): credential = storage_account_key self.fsc = ShareServiceClient( - url, credential=credential, + url, credential=credential.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -55,7 +55,7 @@ def _setup(self, storage_account_name, storage_account_key): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=byte_file, - credential=credential + credential=credential.secret ) file_client.upload_file(self.byte_data) @@ -92,7 +92,7 @@ def test_unicode_get_file_unicode_data(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) file_client.upload_file(file_data) @@ -118,7 +118,7 @@ def test_unicode_get_file_binary_data(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) file_client.upload_file(binary_data) @@ -142,7 +142,7 @@ def test_get_file_no_content(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) file_client.upload_file(file_data) @@ -167,7 +167,7 @@ def test_get_file_to_bytes(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -190,7 +190,7 @@ def test_get_file_to_bytes_with_progress(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -223,7 +223,7 @@ def test_get_file_to_bytes_non_parallel(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -258,7 +258,7 @@ def test_get_file_to_bytes_small(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) file_client.upload_file(file_data) @@ -293,7 +293,7 @@ def test_download_file_modified(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=38, max_chunk_get_size=38) data = b'hello world python storage test chunks' * 5 @@ -321,7 +321,7 @@ def test_get_file_with_iter(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -353,7 +353,7 @@ def test_get_file_to_stream(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -379,7 +379,7 @@ def test_get_file_to_stream_with_progress(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -411,7 +411,7 @@ def test_get_file_to_stream_non_parallel(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -445,7 +445,7 @@ def test_get_file_to_stream_small(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) file_client.upload_file(file_data) @@ -483,7 +483,7 @@ def test_get_file_to_stream_from_snapshot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key) + credential=storage_account_key.secret) file_client.delete_file() snapshot_client = ShareFileClient( @@ -491,7 +491,7 @@ def test_get_file_to_stream_from_snapshot(self, **kwargs): share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, snapshot=share_snapshot, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -520,7 +520,7 @@ def test_get_file_to_stream_with_progress_from_snapshot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key) + credential=storage_account_key.secret) file_client.delete_file() snapshot_client = ShareFileClient( @@ -528,7 +528,7 @@ def test_get_file_to_stream_with_progress_from_snapshot(self, **kwargs): share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, snapshot=share_snapshot, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -563,7 +563,7 @@ def test_get_file_to_stream_non_parallel_from_snapshot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key) + credential=storage_account_key.secret) file_client.delete_file() snapshot_client = ShareFileClient( @@ -571,7 +571,7 @@ def test_get_file_to_stream_non_parallel_from_snapshot(self, **kwargs): share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, snapshot=share_snapshot, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -605,7 +605,7 @@ def test_get_file_to_stream_small_from_snapshot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key) + credential=storage_account_key.secret) file_client.upload_file(file_data) # Create a snapshot of the share and delete the file @@ -618,7 +618,7 @@ def test_get_file_to_stream_small_from_snapshot(self, **kwargs): share_name=self.share_name, file_path=self.directory_name + '/' + file_name, snapshot=share_snapshot, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -652,7 +652,7 @@ def test_ranged_get_file_to_path(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -679,7 +679,7 @@ def test_ranged_get_file_to_path_with_single_byte(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -707,7 +707,7 @@ def test_ranged_get_file_to_bytes_with_zero_byte(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) file_client.upload_file(file_data) @@ -733,7 +733,7 @@ def test_ranged_get_file_to_path_with_progress(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -776,7 +776,7 @@ def test_ranged_get_file_to_path_small(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -800,7 +800,7 @@ def test_ranged_get_file_to_path_non_parallel(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -829,7 +829,7 @@ def test_ranged_get_file_to_path_invalid_range_parallel(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) file_client.upload_file(file_data) @@ -861,7 +861,7 @@ def test_ranged_get_file_to_path_invalid_range_non_parallel(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) file_client.upload_file(file_data) @@ -893,7 +893,7 @@ def test_get_file_to_text(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + text_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) file_client.upload_file(text_data) @@ -919,7 +919,7 @@ def test_get_file_to_text_with_progress(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + text_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) file_client.upload_file(text_data) @@ -956,7 +956,7 @@ def test_get_file_to_text_non_parallel(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + text_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) file_client.upload_file(text_data) @@ -993,7 +993,7 @@ def test_get_file_to_text_small(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) file_client.upload_file(file_data) @@ -1030,7 +1030,7 @@ def test_get_file_to_text_with_encoding(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) file_client.upload_file(data) @@ -1055,7 +1055,7 @@ def test_get_file_to_text_with_encoding_and_progress(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) file_client.upload_file(data) @@ -1089,7 +1089,7 @@ def test_get_file_non_seekable(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -1116,7 +1116,7 @@ def test_get_file_non_seekable_parallel(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -1141,7 +1141,7 @@ def test_get_file_non_seekable_from_snapshot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key) + credential=storage_account_key.secret) file_client.delete_file() snapshot_client = ShareFileClient( @@ -1149,7 +1149,7 @@ def test_get_file_non_seekable_from_snapshot(self, **kwargs): share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, snapshot=share_snapshot, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -1179,7 +1179,7 @@ def test_get_file_non_seekable_parallel_from_snapshot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key) + credential=storage_account_key.secret) file_client.delete_file() snapshot_client = ShareFileClient( @@ -1187,7 +1187,7 @@ def test_get_file_non_seekable_parallel_from_snapshot(self, **kwargs): share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, snapshot=share_snapshot, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -1211,7 +1211,7 @@ def test_get_file_exact_get_size(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) file_client.upload_file(byte_data) @@ -1249,7 +1249,7 @@ def test_get_file_exact_chunk_size(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) file_client.upload_file(byte_data) @@ -1285,7 +1285,7 @@ def test_get_file_with_md5(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -1308,7 +1308,7 @@ def test_get_file_range_with_md5(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -1339,7 +1339,7 @@ def test_get_file_server_encryption(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -1361,7 +1361,7 @@ def test_get_file_properties_server_encryption(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -1384,7 +1384,7 @@ def test_get_file_progress_single_get(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key) + credential=storage_account_key.secret) data = b'a' * 512 file.upload_file(data) @@ -1410,7 +1410,7 @@ def test_get_file_progress_chunked(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=1024, max_chunk_get_size=1024) @@ -1439,7 +1439,7 @@ def test_get_file_progress_chunked_parallel(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=1024, max_chunk_get_size=1024) @@ -1468,7 +1468,7 @@ def test_get_file_progress_range_readinto(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=1024, max_chunk_get_size=1024) diff --git a/sdk/storage/azure-storage-file-share/tests/test_get_file_async.py b/sdk/storage/azure-storage-file-share/tests/test_get_file_async.py index 840832914ac8..f60f2a3eb683 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_get_file_async.py +++ b/sdk/storage/azure-storage-file-share/tests/test_get_file_async.py @@ -38,7 +38,7 @@ async def _setup(self, storage_account_name, storage_account_key): credential = storage_account_key self.fsc = ShareServiceClient( - url, credential=credential, + url, credential=credential.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE ) @@ -58,7 +58,7 @@ async def _setup(self, storage_account_name, storage_account_key): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=byte_file, - credential=storage_account_key + credential=storage_account_key.secret ) try: await file_client.upload_file(self.byte_data) @@ -94,7 +94,7 @@ async def test_unicode_get_file_unicode_data(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) await file_client.upload_file(file_data) @@ -122,7 +122,7 @@ async def test_unicode_get_file_binary_data(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) await file_client.upload_file(binary_data) @@ -148,7 +148,7 @@ async def test_get_file_no_content(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE ) @@ -176,7 +176,7 @@ async def test_get_file_to_bytes(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -201,7 +201,7 @@ async def test_get_file_to_bytes_with_progress(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -236,7 +236,7 @@ async def test_get_file_to_bytes_non_parallel(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -273,7 +273,7 @@ async def test_get_file_to_bytes_small(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) await file_client.upload_file(file_data) @@ -309,7 +309,7 @@ async def test_download_file_modified(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=38, max_chunk_get_size=38) data = b'hello world python storage test chunks' * 5 @@ -338,7 +338,7 @@ async def test_get_file_to_stream(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -368,7 +368,7 @@ async def test_get_file_with_iter(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -401,7 +401,7 @@ async def test_get_file_to_stream_with_progress(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -436,7 +436,7 @@ async def test_get_file_to_stream_non_parallel(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -473,7 +473,7 @@ async def test_get_file_to_stream_small(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) await file_client.upload_file(file_data) @@ -514,7 +514,7 @@ async def test_get_file_to_stream_from_snapshot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key) + credential=storage_account_key.secret) await file_client.delete_file() snapshot_client = ShareFileClient( @@ -522,7 +522,7 @@ async def test_get_file_to_stream_from_snapshot(self, **kwargs): share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, snapshot=share_snapshot, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -554,7 +554,7 @@ async def test_get_file_to_stream_with_progress_from_snapshot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key) + credential=storage_account_key.secret) await file_client.delete_file() snapshot_client = ShareFileClient( @@ -562,7 +562,7 @@ async def test_get_file_to_stream_with_progress_from_snapshot(self, **kwargs): share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, snapshot=share_snapshot, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -600,7 +600,7 @@ async def test_get_file_to_stream_non_parallel_from_snapshot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key) + credential=storage_account_key.secret) await file_client.delete_file() snapshot_client = ShareFileClient( @@ -608,7 +608,7 @@ async def test_get_file_to_stream_non_parallel_from_snapshot(self, **kwargs): share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, snapshot=share_snapshot, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -645,7 +645,7 @@ async def test_get_file_to_stream_small_from_snapshot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key) + credential=storage_account_key.secret) await file_client.upload_file(file_data) # Create a snapshot of the share and delete the file @@ -658,7 +658,7 @@ async def test_get_file_to_stream_small_from_snapshot(self, **kwargs): share_name=self.share_name, file_path=self.directory_name + '/' + file_name, snapshot=share_snapshot, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -695,7 +695,7 @@ async def test_ranged_get_file_to_path(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -726,7 +726,7 @@ async def test_ranged_get_file_to_path_with_single_byte(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -757,7 +757,7 @@ async def test_ranged_get_file_to_bytes_with_zero_byte(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE ) @@ -787,7 +787,7 @@ async def test_ranged_get_file_to_path_with_progress(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -828,7 +828,7 @@ async def test_ranged_get_file_to_path_small(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -855,7 +855,7 @@ async def test_ranged_get_file_to_path_non_parallel(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -887,7 +887,7 @@ async def test_ranged_get_file_to_path_invalid_range_parallel(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) await file_client.upload_file(file_data) @@ -920,7 +920,7 @@ async def test_ranged_get_file_to_path_invalid_range_non_parallel(self, **kwargs self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) await file_client.upload_file(file_data) @@ -954,7 +954,7 @@ async def test_get_file_to_text(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + text_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) await file_client.upload_file(text_data) @@ -982,7 +982,7 @@ async def test_get_file_to_text_with_progress(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + text_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) await file_client.upload_file(text_data) @@ -1021,7 +1021,7 @@ async def test_get_file_to_text_non_parallel(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + text_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) await file_client.upload_file(text_data) @@ -1060,7 +1060,7 @@ async def test_get_file_to_text_small(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) await file_client.upload_file(file_data) @@ -1099,7 +1099,7 @@ async def test_get_file_to_text_with_encoding(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) await file_client.upload_file(data) @@ -1126,7 +1126,7 @@ async def test_get_file_to_text_with_encoding_and_progress(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) await file_client.upload_file(data) @@ -1162,7 +1162,7 @@ async def test_get_file_non_seekable(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -1192,7 +1192,7 @@ async def test_get_file_non_seekable_parallel(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -1220,7 +1220,7 @@ async def test_get_file_non_seekable_from_snapshot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key) + credential=storage_account_key.secret) await file_client.delete_file() snapshot_client = ShareFileClient( @@ -1228,7 +1228,7 @@ async def test_get_file_non_seekable_from_snapshot(self, **kwargs): share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, snapshot=share_snapshot, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -1261,7 +1261,7 @@ async def test_get_file_non_seekable_parallel_from_snapshot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key) + credential=storage_account_key.secret) await file_client.delete_file() snapshot_client = ShareFileClient( @@ -1269,7 +1269,7 @@ async def test_get_file_non_seekable_parallel_from_snapshot(self, **kwargs): share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, snapshot=share_snapshot, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -1296,7 +1296,7 @@ async def test_get_file_exact_get_size(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) await file_client.upload_file(byte_data) @@ -1336,7 +1336,7 @@ async def test_get_file_exact_chunk_size(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) await file_client.upload_file(byte_data) @@ -1374,7 +1374,7 @@ async def test_get_file_with_md5(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -1398,7 +1398,7 @@ async def test_get_file_range_with_md5(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -1431,7 +1431,7 @@ async def test_get_file_server_encryption(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -1454,7 +1454,7 @@ async def test_get_file_properties_server_encryption(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + self.byte_file, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=self.MAX_SINGLE_GET_SIZE, max_chunk_get_size=self.MAX_CHUNK_GET_SIZE) @@ -1478,7 +1478,7 @@ async def test_get_file_progress_single_get(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key) + credential=storage_account_key.secret) data = b'a' * 512 await file.upload_file(data) @@ -1505,7 +1505,7 @@ async def test_get_file_progress_chunked(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=1024, max_chunk_get_size=1024) @@ -1535,7 +1535,7 @@ async def test_get_file_progress_chunked_parallel(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=1024, max_chunk_get_size=1024) @@ -1565,7 +1565,7 @@ async def test_get_file_progress_range_readinto(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=self.share_name, file_path=self.directory_name + '/' + file_name, - credential=storage_account_key, + credential=storage_account_key.secret, max_single_get_size=1024, max_chunk_get_size=1024) diff --git a/sdk/storage/azure-storage-file-share/tests/test_handle.py b/sdk/storage/azure-storage-file-share/tests/test_handle.py index 07ccb3095617..20f957a55390 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_handle.py +++ b/sdk/storage/azure-storage-file-share/tests/test_handle.py @@ -21,7 +21,7 @@ class TestStorageHandle(StorageRecordedTestCase): def _setup(self, storage_account_name, storage_account_key): file_url = self.account_url(storage_account_name, "file") credentials = storage_account_key - self.fsc = ShareServiceClient(account_url=file_url, credential=credentials) + self.fsc = ShareServiceClient(account_url=file_url, credential=credentials.secret) # --Helpers----------------------------------------------------------------- diff --git a/sdk/storage/azure-storage-file-share/tests/test_handle_async.py b/sdk/storage/azure-storage-file-share/tests/test_handle_async.py index 06c7592d444e..b6f00fa9f6ef 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_handle_async.py +++ b/sdk/storage/azure-storage-file-share/tests/test_handle_async.py @@ -21,7 +21,7 @@ class TestStorageHandleAsync(AsyncStorageRecordedTestCase): def _setup(self, storage_account, storage_account_key): file_url = self.account_url(storage_account, "file") credentials = storage_account_key - self.fsc = ShareServiceClient(account_url=file_url, credential=credentials) + self.fsc = ShareServiceClient(account_url=file_url, credential=credentials.secret) # --Helpers----------------------------------------------------------------- diff --git a/sdk/storage/azure-storage-file-share/tests/test_share.py b/sdk/storage/azure-storage-file-share/tests/test_share.py index a2424094f5ed..e85ba972a348 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_share.py +++ b/sdk/storage/azure-storage-file-share/tests/test_share.py @@ -51,7 +51,7 @@ class TestStorageShare(StorageRecordedTestCase): def _setup(self, storage_account_name, storage_account_key): file_url = self.account_url(storage_account_name, "file") credentials = storage_account_key - self.fsc = ShareServiceClient(account_url=file_url, credential=credentials) + self.fsc = ShareServiceClient(account_url=file_url, credential=credentials.secret) self.test_shares = [] def _teardown(self, FILE_PATH): @@ -171,7 +171,7 @@ def test_create_snapshot_with_metadata(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=share.share_name, snapshot=snapshot, - credential=storage_account_key + credential=storage_account_key.secret ) snapshot_props = snapshot_client.get_share_properties() # Assert @@ -244,7 +244,7 @@ def test_acquire_lease_on_sharesnapshot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=share.share_name, snapshot=snapshot, - credential=storage_account_key + credential=storage_account_key.secret ) share_lease = share.acquire_lease(lease_id='00000000-1111-2222-3333-444444444444') @@ -557,7 +557,7 @@ def test_delete_snapshot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=share.share_name, snapshot=snapshot, - credential=storage_account_key + credential=storage_account_key.secret ) deleted = snapshot_client.delete_share() @@ -965,7 +965,7 @@ def test_list_shares_account_sas(self, **kwargs): sas_token = self.generate_sas( generate_account_sas, storage_account_name, - storage_account_key, + storage_account_key.secret, ResourceTypes(service=True), AccountSasPermissions(list=True), datetime.utcnow() + timedelta(hours=1), @@ -993,7 +993,7 @@ def test_list_shares_account_sas_fails(self, **kwargs): sas_token = self.generate_sas( generate_account_sas, storage_account_name, - storage_account_key, + storage_account_key.secret, ResourceTypes(service=True), AccountSasPermissions(list=True), datetime.utcnow() - timedelta(hours=1) @@ -1616,7 +1616,7 @@ def test_transport_closed_only_once(self, **kwargs): credential = storage_account_key prefix = TEST_SHARE_PREFIX share_name = self.get_resource_name(prefix) - with ShareServiceClient(url, credential=credential, transport=transport) as fsc: + with ShareServiceClient(url, credential=credential.secret, transport=transport) as fsc: fsc.get_service_properties() assert transport.session is not None with fsc.get_share_client(share_name) as fc: @@ -1933,7 +1933,7 @@ def test_share_user_delegation_oid(self, **kwargs): generate_share_sas, share.account_name, share.share_name, - storage_account_key, + storage_account_key.secret, permission=ShareSasPermissions(read=True, list=True), expiry=datetime.utcnow() + timedelta(hours=1), user_delegation_key=user_delegation_key, @@ -1954,7 +1954,7 @@ def test_share_user_delegation_oid(self, **kwargs): file.account_name, file.share_name, file.file_path, - storage_account_key, + storage_account_key.secret, permission=FileSasPermissions(read=True), expiry=datetime.utcnow() + timedelta(hours=1), user_delegation_key=user_delegation_key, diff --git a/sdk/storage/azure-storage-file-share/tests/test_share_async.py b/sdk/storage/azure-storage-file-share/tests/test_share_async.py index 5efc244e8553..4283eda52b41 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_share_async.py +++ b/sdk/storage/azure-storage-file-share/tests/test_share_async.py @@ -48,7 +48,7 @@ class TestStorageShareAsync(AsyncStorageRecordedTestCase): def _setup(self, storage_account_name, storage_account_key): file_url = self.account_url(storage_account_name, "file") credentials = storage_account_key - self.fsc = ShareServiceClient(account_url=file_url, credential=credentials) + self.fsc = ShareServiceClient(account_url=file_url, credential=credentials.secret) self.test_shares = [] def _teardown(self, FILE_PATH): @@ -156,7 +156,7 @@ async def test_create_snapshot_with_metadata(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=share.share_name, snapshot=snapshot, - credential=storage_account_key + credential=storage_account_key.secret ) snapshot_props = await snapshot_client.get_share_properties() # Assert @@ -232,7 +232,7 @@ async def test_acquire_lease_on_sharesnapshot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=share.share_name, snapshot=snapshot, - credential=storage_account_key + credential=storage_account_key.secret ) share_lease = await share.acquire_lease(lease_id='00000000-1111-2222-3333-444444444444') @@ -550,7 +550,7 @@ async def test_delete_snapshot(self, **kwargs): self.account_url(storage_account_name, "file"), share_name=share.share_name, snapshot=snapshot, - credential=storage_account_key + credential=storage_account_key.secret ) deleted = await snapshot_client.delete_share() @@ -976,7 +976,7 @@ async def test_list_shares_account_sas(self, **kwargs): sas_token = self.generate_sas( generate_account_sas, storage_account_name, - storage_account_key, + storage_account_key.secret, ResourceTypes(service=True), AccountSasPermissions(list=True), datetime.utcnow() + timedelta(hours=1), @@ -1006,7 +1006,7 @@ async def test_list_shares_account_sas_fails(self, **kwargs): sas_token = self.generate_sas( generate_account_sas, storage_account_name, - storage_account_key, + storage_account_key.secret, ResourceTypes(service=True), AccountSasPermissions(list=True), datetime.utcnow() - timedelta(hours=1) @@ -1649,7 +1649,7 @@ async def test_transport_closed_only_once(self, **kwargs): credential = storage_account_key prefix = TEST_SHARE_PREFIX share_name = self.get_resource_name(prefix) - async with ShareServiceClient(url, credential=credential, transport=transport) as fsc: + async with ShareServiceClient(url, credential=credential.secret, transport=transport) as fsc: await fsc.get_service_properties() assert transport.session is not None async with fsc.get_share_client(share_name) as fc: @@ -1972,7 +1972,7 @@ async def test_share_user_delegation_oid(self, **kwargs): generate_share_sas, share.account_name, share.share_name, - storage_account_key, + storage_account_key.secret, permission=ShareSasPermissions(read=True, list=True), expiry=expiry, user_delegation_key=user_delegation_key, @@ -1995,7 +1995,7 @@ async def test_share_user_delegation_oid(self, **kwargs): file.account_name, file.share_name, file.file_path, - storage_account_key, + storage_account_key.secret, permission=FileSasPermissions(read=True), expiry=datetime.utcnow() + timedelta(hours=1), user_delegation_key=user_delegation_key, diff --git a/sdk/storage/azure-storage-queue/tests/settings/testcase.py b/sdk/storage/azure-storage-queue/tests/settings/testcase.py index 5d139ce47608..5598f9302918 100644 --- a/sdk/storage/azure-storage-queue/tests/settings/testcase.py +++ b/sdk/storage/azure-storage-queue/tests/settings/testcase.py @@ -12,7 +12,7 @@ except ImportError: import mock -from devtools_testutils import PowerShellPreparer +from devtools_testutils import EnvironmentVariableLoader, EnvironmentVariableOptions from devtools_testutils.fake_credentials import STORAGE_ACCOUNT_FAKE_KEY try: @@ -38,10 +38,11 @@ QueuePreparer = functools.partial( - PowerShellPreparer, + EnvironmentVariableLoader, "storage", storage_account_name="storagename", storage_account_key=STORAGE_ACCOUNT_FAKE_KEY, + options=EnvironmentVariableOptions(hide_secrets=["storage_account_key"]), ) diff --git a/sdk/storage/azure-storage-queue/tests/test_queue.py b/sdk/storage/azure-storage-queue/tests/test_queue.py index fa42c83b76fa..c9aabaaadf36 100644 --- a/sdk/storage/azure-storage-queue/tests/test_queue.py +++ b/sdk/storage/azure-storage-queue/tests/test_queue.py @@ -62,7 +62,7 @@ def test_create_queue(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) created = queue_client.create_queue() @@ -76,7 +76,7 @@ def test_create_queue_fail_on_exist(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) created = queue_client.create_queue() with pytest.raises(ResourceExistsError): @@ -93,7 +93,7 @@ def test_create_queue_fail_on_exist_different_metadata(self, **kwargs): # Action url = self.account_url(storage_account_name, "queue") - qsc = QueueServiceClient(url, storage_account_key) + qsc = QueueServiceClient(url, storage_account_key.secret) queue_client = self._get_queue_reference(qsc) created = queue_client.create_queue() with pytest.raises(ResourceExistsError): @@ -110,7 +110,7 @@ def test_create_queue_with_options(self, **kwargs): # Action url = self.account_url(storage_account_name, "queue") - qsc = QueueServiceClient(url, storage_account_key) + qsc = QueueServiceClient(url, storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue(metadata={"val1": "test", "val2": "blah"}) props = queue_client.get_queue_properties() @@ -128,7 +128,7 @@ def test_delete_non_existing_queue(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) # Asserts @@ -142,7 +142,7 @@ def test_delete_existing_queue_fail_not_exist(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) created = queue_client.create_queue() @@ -158,7 +158,7 @@ def test_list_queues(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queues = list(qsc.list_queues()) @@ -175,7 +175,7 @@ def test_list_queues_with_options(self, **kwargs): # Arrange prefix = "listqueue" - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_list = [] for i in range(0, 4): self._create_queue(qsc, prefix + str(i), queue_list) @@ -209,7 +209,7 @@ def test_list_queues_with_metadata(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = self._get_queue_reference(qsc) queue.create_queue() queue.set_queue_metadata(metadata={"val1": "test", "val2": "blah"}) @@ -232,13 +232,13 @@ def test_list_queues_account_sas(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() sas_token = self.generate_sas( generate_account_sas, storage_account_name, - storage_account_key, + storage_account_key.secret, ResourceTypes(service=True), AccountSasPermissions(list=True), datetime.utcnow() + timedelta(hours=1), @@ -259,7 +259,7 @@ def test_set_queue_metadata(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = self._get_queue_reference(qsc) metadata = {"hello": "world", "number": "43"} queue.create_queue() @@ -277,7 +277,7 @@ def test_get_queue_metadata_message_count(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() sent_message = queue_client.send_message("message1") @@ -295,7 +295,7 @@ def test_queue_exists(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = self._get_queue_reference(qsc) queue.create_queue() @@ -312,7 +312,7 @@ def test_queue_not_exists(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = qsc.get_queue_client(self.get_resource_name("missing")) # Act with pytest.raises(ResourceNotFoundError): @@ -327,7 +327,7 @@ def test_put_message(self, **kwargs): storage_account_key = kwargs.pop("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_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message("message1") @@ -350,7 +350,7 @@ def test_put_message_large_time_to_live(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) 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 @@ -369,7 +369,7 @@ def test_put_message_infinite_time_to_live(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message("message1", time_to_live=-1) @@ -387,7 +387,7 @@ def test_get_messages(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message("message1") @@ -415,7 +415,7 @@ def test_receive_one_message(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() assert queue_client.receive_message() is None @@ -451,7 +451,7 @@ def test_get_messages_with_options(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message("message1") @@ -482,7 +482,7 @@ def test_get_messages_with_max_messages(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message("message1") @@ -519,7 +519,7 @@ def test_get_messages_with_too_little_messages(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message("message1") @@ -551,7 +551,7 @@ def test_get_messages_with_page_bigger_than_max(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message("message1") @@ -571,7 +571,7 @@ def test_get_messages_with_remainder(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message("message1") @@ -627,7 +627,7 @@ def test_peek_messages(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message("message1") @@ -656,7 +656,7 @@ def test_peek_messages_with_options(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message("message1") @@ -685,7 +685,7 @@ def test_clear_messages(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message("message1") @@ -706,7 +706,7 @@ def test_delete_message(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message("message1") @@ -730,7 +730,7 @@ def test_update_message(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message("message1") @@ -767,7 +767,7 @@ def test_update_message_content(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message("message1") @@ -806,7 +806,7 @@ def test_account_sas(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message("message1") @@ -844,7 +844,7 @@ def test_azure_named_key_credential_access(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - named_key = AzureNamedKeyCredential(storage_account_name, storage_account_key) + named_key = AzureNamedKeyCredential(storage_account_name, storage_account_key.secret) qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), named_key) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() @@ -897,7 +897,7 @@ def test_sas_read(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message("message1") @@ -933,7 +933,7 @@ def test_sas_add(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() token = self.generate_sas( @@ -963,7 +963,7 @@ def test_sas_update(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message("message1") @@ -1001,7 +1001,7 @@ def test_sas_process(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message("message1") @@ -1043,7 +1043,7 @@ def test_sas_signed_identifier(self, **kwargs): identifiers = {"testid": access_policy} - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() resp = queue_client.set_queue_access_policy(identifiers) @@ -1082,7 +1082,7 @@ def test_get_queue_acl(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() @@ -1100,7 +1100,7 @@ def test_get_queue_acl_iter(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() @@ -1120,7 +1120,7 @@ def test_get_queue_acl_with_non_existing_queue(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) # Act @@ -1136,7 +1136,7 @@ def test_set_queue_acl(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() @@ -1155,7 +1155,7 @@ def test_set_queue_acl_with_empty_signed_identifiers(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() @@ -1174,7 +1174,7 @@ def test_set_queue_acl_with_empty_signed_identifier(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() @@ -1198,7 +1198,7 @@ def test_set_queue_acl_with_signed_identifiers(self, **kwargs): variables = kwargs.pop("variables", {}) # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() @@ -1226,7 +1226,7 @@ def test_set_queue_acl_too_many_ids(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() @@ -1246,7 +1246,7 @@ def test_set_queue_acl_with_non_existing_queue(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) # Act @@ -1262,7 +1262,7 @@ def test_unicode_create_queue_unicode_name(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_name = "啊齄丂狛狜" with pytest.raises(HttpResponseError): @@ -1279,7 +1279,7 @@ def test_unicode_get_messages_unicode_data(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message("message1㚈") @@ -1302,7 +1302,7 @@ def test_unicode_update_message_unicode_data(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) queue_client.create_queue() queue_client.send_message("message1") @@ -1333,7 +1333,7 @@ def test_transport_closed_only_once(self, **kwargs): 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 + self.account_url(storage_account_name, "queue"), credential=storage_account_key.secret, transport=transport ) as qsc: qsc.get_service_properties() assert transport.session is not None @@ -1349,7 +1349,7 @@ def test_storage_account_audience_queue_service_client(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) qsc.get_service_properties() # Act @@ -1371,7 +1371,7 @@ def test_bad_audience_queue_service_client(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) qsc.get_service_properties() # Act @@ -1392,7 +1392,7 @@ def test_storage_account_audience_queue_client(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - queue = QueueClient(self.account_url(storage_account_name, "queue"), "testqueue1", storage_account_key) + queue = QueueClient(self.account_url(storage_account_name, "queue"), "testqueue1", storage_account_key.secret) queue.create_queue() # Act @@ -1415,7 +1415,7 @@ def test_bad_audience_queue_client(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - queue = QueueClient(self.account_url(storage_account_name, "queue"), "testqueue2", storage_account_key) + queue = QueueClient(self.account_url(storage_account_name, "queue"), "testqueue2", storage_account_key.secret) queue.create_queue() # Act @@ -1486,7 +1486,7 @@ def test_queue_user_delegation_oid(self, **kwargs): generate_queue_sas, queue.account_name, queue.queue_name, - storage_account_key, + storage_account_key.secret, permission=QueueSasPermissions(add=True, read=True, process=True), expiry=expiry, user_delegation_key=user_delegation_key, 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 7461dbb4d06a..3ff3bac1c53d 100644 --- a/sdk/storage/azure-storage-queue/tests/test_queue_async.py +++ b/sdk/storage/azure-storage-queue/tests/test_queue_async.py @@ -60,7 +60,7 @@ async def test_create_queue(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) created = await queue_client.create_queue() @@ -74,7 +74,7 @@ async def test_create_queue_fail_on_exist(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) created = await queue_client.create_queue() with pytest.raises(ResourceExistsError): @@ -90,7 +90,7 @@ async def test_create_queue_fail_on_exist_different_metadata(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) created = await queue_client.create_queue() with pytest.raises(ResourceExistsError): @@ -106,7 +106,7 @@ async def test_create_queue_with_options(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) await queue_client.create_queue(metadata={"val1": "test", "val2": "blah"}) props = await queue_client.get_queue_properties() @@ -124,7 +124,7 @@ async def test_get_messages_with_max_messages(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) await queue_client.create_queue() await queue_client.send_message("message1") @@ -162,7 +162,7 @@ async def test_get_messages_with_too_little_messages(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) await queue_client.create_queue() await queue_client.send_message("message1") @@ -195,7 +195,7 @@ async def test_get_messages_with_page_bigger_than_max(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) await queue_client.create_queue() await queue_client.send_message("message1") @@ -215,7 +215,7 @@ async def test_get_messages_with_remainder(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) await queue_client.create_queue() await queue_client.send_message("message1") @@ -273,7 +273,7 @@ async def test_delete_non_existing_queue(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) # Asserts @@ -287,7 +287,7 @@ async def test_delete_existing_queue_fail_not_exist(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) created = await queue_client.create_queue() @@ -303,7 +303,7 @@ async def test_list_queues(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) await queue_client.create_queue() queues = [] @@ -321,7 +321,7 @@ async def test_list_queues_with_options(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_list = [] prefix = "listqueue" for i in range(0, 4): @@ -359,7 +359,7 @@ async def test_list_queues_with_metadata(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = await self._create_queue(qsc) await queue.set_queue_metadata(metadata={"val1": "test", "val2": "blah"}) @@ -382,13 +382,13 @@ async def test_list_queues_account_sas(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) await queue_client.create_queue() sas_token = self.generate_sas( generate_account_sas, storage_account_name, - storage_account_key, + storage_account_key.secret, ResourceTypes(service=True), AccountSasPermissions(list=True), datetime.utcnow() + timedelta(hours=1), @@ -411,7 +411,7 @@ async def test_set_queue_metadata(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) metadata = {"hello": "world", "number": "43"} queue = await self._create_queue(qsc) @@ -429,7 +429,7 @@ async def test_get_queue_metadata_message_count(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = await self._create_queue(qsc) await queue_client.send_message("message1") props = await queue_client.get_queue_properties() @@ -445,7 +445,7 @@ async def test_queue_exists(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = await self._create_queue(qsc) # Act @@ -461,7 +461,7 @@ async def test_queue_not_exists(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = qsc.get_queue_client(self.get_resource_name("missing")) # Act with pytest.raises(ResourceNotFoundError): @@ -476,7 +476,7 @@ async def test_put_message(self, **kwargs): storage_account_key = kwargs.pop("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_name, "queue"), storage_account_key.secret) queue_client = await self._create_queue(qsc) await queue_client.send_message("message1") await queue_client.send_message("message2") @@ -498,7 +498,7 @@ async def test_put_message_large_time_to_live(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) 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("message1", time_to_live=1024 * 1024 * 1024) @@ -516,7 +516,7 @@ async def test_put_message_infinite_time_to_live(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = await self._create_queue(qsc) await queue_client.send_message("message1", time_to_live=-1) @@ -533,7 +533,7 @@ async def test_get_messages(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = await self._create_queue(qsc) await queue_client.send_message("message1") await queue_client.send_message("message2") @@ -564,7 +564,7 @@ async def test_receive_one_message(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = await self._create_queue(qsc) assert await queue_client.receive_message() is None @@ -599,7 +599,7 @@ async def test_get_messages_with_options(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = await self._create_queue(qsc) await queue_client.send_message("message1") await queue_client.send_message("message2") @@ -631,7 +631,7 @@ async def test_peek_messages(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = await self._create_queue(qsc) await queue_client.send_message("message1") await queue_client.send_message("message2") @@ -659,7 +659,7 @@ async def test_peek_messages_with_options(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = await self._create_queue(qsc) await queue_client.send_message("message1") await queue_client.send_message("message2") @@ -687,7 +687,7 @@ async def test_clear_messages(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = await self._create_queue(qsc) await queue_client.send_message("message1") await queue_client.send_message("message2") @@ -707,7 +707,7 @@ async def test_delete_message(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = await self._create_queue(qsc) await queue_client.send_message("message1") await queue_client.send_message("message2") @@ -730,7 +730,7 @@ async def test_update_message(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = await self._create_queue(qsc) await queue_client.send_message("message1") messages = [] @@ -771,7 +771,7 @@ async def test_update_message_content(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = await self._create_queue(qsc) await queue_client.send_message("message1") @@ -814,7 +814,7 @@ async def test_account_sas(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Arrange queue_client = await self._create_queue(qsc) @@ -853,7 +853,7 @@ async def test_azure_named_key_credential_access(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - named_key = AzureNamedKeyCredential(storage_account_name, storage_account_key) + named_key = AzureNamedKeyCredential(storage_account_name, storage_account_key.secret) qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), named_key) queue_client = self._get_queue_reference(qsc) await queue_client.create_queue() @@ -881,7 +881,7 @@ async def test_token_credential(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) token_credential = self.get_credential(QueueServiceClient, is_async=True) # Action 1: make sure token works @@ -906,7 +906,7 @@ async def test_sas_read(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Arrange queue_client = await self._create_queue(qsc) @@ -942,7 +942,7 @@ async def test_sas_add(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Arrange queue_client = await self._create_queue(qsc) @@ -976,7 +976,7 @@ async def test_sas_update(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Arrange queue_client = await self._create_queue(qsc) @@ -1019,7 +1019,7 @@ async def test_sas_process(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Arrange queue_client = await self._create_queue(qsc) @@ -1055,7 +1055,7 @@ async def test_sas_signed_identifier(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") variables = kwargs.pop("variables", {}) - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Arrange access_policy = AccessPolicy() @@ -1103,7 +1103,7 @@ async def test_get_queue_acl(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Arrange queue_client = await self._create_queue(qsc) @@ -1120,7 +1120,7 @@ async def test_get_queue_acl_iter(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Arrange queue_client = await self._create_queue(qsc) @@ -1139,7 +1139,7 @@ async def test_get_queue_acl_with_non_existing_queue(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Arrange queue_client = self._get_queue_reference(qsc) @@ -1155,7 +1155,7 @@ async def test_set_queue_acl(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Arrange queue_client = await self._create_queue(qsc) @@ -1173,7 +1173,7 @@ async def test_set_queue_acl_with_empty_signed_identifiers(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Arrange queue_client = await self._create_queue(qsc) @@ -1191,7 +1191,7 @@ async def test_set_queue_acl_with_empty_signed_identifier(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Arrange queue_client = await self._create_queue(qsc) @@ -1215,7 +1215,7 @@ async def test_set_queue_acl_with_signed_identifiers(self, **kwargs): variables = kwargs.pop("variables", {}) # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = await self._create_queue(qsc) # Act @@ -1242,7 +1242,7 @@ async def test_set_queue_acl_too_many_ids(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = await self._create_queue(qsc) # Act @@ -1261,7 +1261,7 @@ async def test_set_queue_acl_with_non_existing_queue(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = self._get_queue_reference(qsc) # Act @@ -1275,7 +1275,7 @@ async def test_unicode_create_queue_unicode_name(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_name = "啊齄丂狛狜" with pytest.raises(HttpResponseError): @@ -1292,7 +1292,7 @@ async def test_unicode_get_messages_unicode_data(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = await self._create_queue(qsc) await queue_client.send_message("message1㚈") message = None @@ -1315,7 +1315,7 @@ async def test_unicode_update_message_unicode_data(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue_client = await self._create_queue(qsc) await queue_client.send_message("message1") messages = [] @@ -1349,7 +1349,7 @@ async def test_transport_closed_only_once(self, **kwargs): 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 + self.account_url(storage_account_name, "queue"), credential=storage_account_key.secret, transport=transport ) as qsc: await qsc.get_service_properties() assert transport.session is not None @@ -1365,7 +1365,7 @@ async def test_storage_account_audience_queue_service_client(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) await qsc.get_service_properties() # Act @@ -1387,7 +1387,7 @@ async def test_bad_audience_queue_service_client(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) await qsc.get_service_properties() # Act @@ -1409,7 +1409,7 @@ async def test_storage_account_audience_queue_client(self, **kwargs): # Arrange queue_name = self.get_resource_name(TEST_QUEUE_PREFIX) - queue = QueueClient(self.account_url(storage_account_name, "queue"), queue_name, storage_account_key) + queue = QueueClient(self.account_url(storage_account_name, "queue"), queue_name, storage_account_key.secret) await queue.create_queue() # Act @@ -1433,7 +1433,7 @@ async def test_bad_audience_queue_client(self, **kwargs): # Arrange queue_name = self.get_resource_name(TEST_QUEUE_PREFIX) - queue = QueueClient(self.account_url(storage_account_name, "queue"), queue_name, storage_account_key) + queue = QueueClient(self.account_url(storage_account_name, "queue"), queue_name, storage_account_key.secret) await queue.create_queue() # Act @@ -1504,7 +1504,7 @@ async def test_queue_user_delegation_oid(self, **kwargs): generate_queue_sas, queue.account_name, queue.queue_name, - storage_account_key, + storage_account_key.secret, permission=QueueSasPermissions(add=True, read=True, process=True), expiry=expiry, user_delegation_key=user_delegation_key, 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 8a8ec9150fdb..eefb88c6ce13 100644 --- a/sdk/storage/azure-storage-queue/tests/test_queue_client.py +++ b/sdk/storage/azure-storage-queue/tests/test_queue_client.py @@ -43,7 +43,7 @@ def validate_standard_account_endpoints(self, service, url_type, account_name, a assert service is not None assert service.account_name == account_name assert service.credential.account_name == account_name - assert service.credential.account_key == account_key + assert service.credential.account_key == account_key.secret assert f"{account_name}.{url_type}.core.windows.net" in service.url assert f"{account_name}-secondary.{url_type}.core.windows.net" in service.secondary_endpoint @@ -70,7 +70,7 @@ def test_create_service_with_key(self, **kwargs): 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_name, "queue"), credential=storage_account_key.secret, queue_name="foo" ) # Assert @@ -85,7 +85,7 @@ def test_create_service_with_connection_string(self, **kwargs): for service_type in SERVICES.items(): # Act service = service_type[0].from_connection_string( - self.connection_string(storage_account_name, storage_account_key), queue_name="test" + self.connection_string(storage_account_name, storage_account_key.secret), queue_name="test" ) # Assert @@ -156,13 +156,13 @@ def test_create_service_china(self, **kwargs): for service_type in SERVICES.items(): # Act url = self.account_url(storage_account_name, "queue").replace("core.windows.net", "core.chinacloudapi.cn") - service = service_type[0](url, credential=storage_account_key, queue_name="foo") + service = service_type[0](url, credential=storage_account_key.secret, queue_name="foo") # Assert assert service is not None assert service.account_name == storage_account_name assert service.credential.account_name == storage_account_name - assert service.credential.account_key == storage_account_key + assert service.credential.account_key == storage_account_key.secret assert ( service.primary_endpoint.startswith( f"https://{storage_account_name}.{service_type[1]}.core.chinacloudapi.cn" @@ -186,7 +186,7 @@ def test_create_service_protocol(self, **kwargs): for service_type in SERVICES.items(): # Act url = self.account_url(storage_account_name, "queue").replace("https", "http") - service = service_type[0](url, credential=storage_account_key, queue_name="foo") + service = service_type[0](url, credential=storage_account_key.secret, queue_name="foo") # Assert self.validate_standard_account_endpoints( @@ -219,11 +219,11 @@ def test_create_service_with_socket_timeout(self, **kwargs): 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_name, "queue"), credential=storage_account_key.secret, queue_name="foo" ) service = service_type[0]( self.account_url(storage_account_name, "queue"), - credential=storage_account_key, + credential=storage_account_key.secret, queue_name="foo", connection_timeout=22, ) @@ -242,7 +242,7 @@ def test_create_service_with_connection_string_key(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - conn_string = f"AccountName={storage_account_name};AccountKey={storage_account_key};" + conn_string = f"AccountName={storage_account_name};AccountKey={storage_account_key.secret};" for service_type in SERVICES.items(): # Act @@ -281,7 +281,7 @@ def test_create_service_with_connection_string_endpoint_protocol(self, **kwargs) # Arrange conn_string = ( f"AccountName={storage_account_name};" - f"AccountKey={storage_account_key};" + f"AccountKey={storage_account_key.secret};" "DefaultEndpointsProtocol=http;" "EndpointSuffix=core.chinacloudapi.cn;" ) @@ -294,7 +294,7 @@ def test_create_service_with_connection_string_endpoint_protocol(self, **kwargs) assert service is not None assert service.account_name == storage_account_name assert service.credential.account_name == storage_account_name - assert service.credential.account_key == storage_account_key + assert service.credential.account_key == storage_account_key.secret assert ( service.primary_endpoint.startswith( f"http://{storage_account_name}.{service_type[1]}.core.chinacloudapi.cn/" @@ -332,7 +332,7 @@ def test_create_service_with_connection_string_custom_domain(self, **kwargs): for service_type in SERVICES.items(): conn_string = ( f"AccountName={storage_account_name};" - f"AccountKey={storage_account_key};" + f"AccountKey={storage_account_key.secret};" "QueueEndpoint=www.mydomain.com;" ) @@ -343,7 +343,7 @@ def test_create_service_with_connection_string_custom_domain(self, **kwargs): assert service is not None assert service.account_name == storage_account_name assert service.credential.account_name == storage_account_name - assert service.credential.account_key == storage_account_key + assert service.credential.account_key == storage_account_key.secret assert service.primary_endpoint.startswith("https://www.mydomain.com/") assert ( service.secondary_endpoint.startswith( @@ -361,7 +361,7 @@ def test_create_service_with_conn_str_custom_domain_trailing_slash(self, **kwarg for service_type in SERVICES.items(): conn_string = ( f"AccountName={storage_account_name};" - f"AccountKey={storage_account_key};" + f"AccountKey={storage_account_key.secret};" "QueueEndpoint=www.mydomain.com/;" ) # Act @@ -371,7 +371,7 @@ def test_create_service_with_conn_str_custom_domain_trailing_slash(self, **kwarg assert service is not None assert service.account_name == storage_account_name assert service.credential.account_name == storage_account_name - assert service.credential.account_key == storage_account_key + assert service.credential.account_key == storage_account_key.secret assert service.primary_endpoint.startswith("https://www.mydomain.com/") assert ( service.secondary_endpoint.startswith( @@ -389,7 +389,7 @@ def test_create_service_with_conn_str_custom_domain_sec_override(self, **kwargs) for service_type in SERVICES.items(): conn_string = ( f"AccountName={storage_account_name};" - f"AccountKey={storage_account_key};" + f"AccountKey={storage_account_key.secret};" "QueueEndpoint=www.mydomain.com/;" ) # Act @@ -401,7 +401,7 @@ def test_create_service_with_conn_str_custom_domain_sec_override(self, **kwargs) assert service is not None assert service.account_name == storage_account_name assert service.credential.account_name == storage_account_name - assert service.credential.account_key == storage_account_key + assert service.credential.account_key == storage_account_key.secret assert service.primary_endpoint.startswith("https://www.mydomain.com/") assert service.secondary_endpoint.startswith("https://www-sec.mydomain.com/") @@ -414,7 +414,7 @@ def test_create_service_with_conn_str_fails_if_sec_without_primary(self, **kwarg # Arrange conn_string = ( f"AccountName={storage_account_name};" - f"AccountKey={storage_account_key};" + f"AccountKey={storage_account_key.secret};" f"{_CONNECTION_ENDPOINTS_SECONDARY.get(service_type[1])}=www.mydomain.com;" ) # Act @@ -432,7 +432,7 @@ def test_create_service_with_conn_str_succeeds_if_sec_with_primary(self, **kwarg # Arrange conn_string = ( f"AccountName={storage_account_name};" - f"AccountKey={storage_account_key};" + f"AccountKey={storage_account_key.secret};" f"{_CONNECTION_ENDPOINTS.get(service_type[1])}=www.mydomain.com;" f"{_CONNECTION_ENDPOINTS_SECONDARY.get(service_type[1])}=www-sec.mydomain.com;" ) @@ -443,7 +443,7 @@ def test_create_service_with_conn_str_succeeds_if_sec_with_primary(self, **kwarg assert service is not None assert service.account_name == storage_account_name assert service.credential.account_name == storage_account_name - assert service.credential.account_key == storage_account_key + assert service.credential.account_key == storage_account_key.secret assert service.primary_endpoint.startswith("https://www.mydomain.com/") assert service.secondary_endpoint.startswith("https://www-sec.mydomain.com/") @@ -457,7 +457,7 @@ def test_create_service_with_custom_account_endpoint_path(self, **kwargs): conn_string = ( f"DefaultEndpointsProtocol=http;" f"AccountName={storage_account_name};" - f"AccountKey={storage_account_key};" + f"AccountKey={storage_account_key.secret};" f"QueueEndpoint={custom_account_url};" ) # Act @@ -466,7 +466,7 @@ def test_create_service_with_custom_account_endpoint_path(self, **kwargs): # Assert assert service.account_name == storage_account_name assert service.credential.account_name == storage_account_name - assert service.credential.account_key == storage_account_key + assert service.credential.account_key == storage_account_key.secret assert service.primary_hostname == "local-machine:11002/custom/account/path" service = QueueServiceClient(account_url=custom_account_url) @@ -496,7 +496,9 @@ def test_request_callback_signed_header(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - service = QueueServiceClient(self.account_url(storage_account_name, "queue"), credential=storage_account_key) + service = QueueServiceClient( + self.account_url(storage_account_name, "queue"), credential=storage_account_key.secret + ) name = self.get_resource_name("cont") # Act @@ -517,7 +519,9 @@ def test_response_callback(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - service = QueueServiceClient(self.account_url(storage_account_name, "queue"), credential=storage_account_key) + service = QueueServiceClient( + self.account_url(storage_account_name, "queue"), credential=storage_account_key.secret + ) name = self.get_resource_name("cont") queue = service.get_queue_client(name) @@ -536,7 +540,9 @@ def test_user_agent_default(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - service = QueueServiceClient(self.account_url(storage_account_name, "queue"), credential=storage_account_key) + service = QueueServiceClient( + self.account_url(storage_account_name, "queue"), credential=storage_account_key.secret + ) def callback(response): assert "User-Agent" in response.http_request.headers @@ -552,7 +558,9 @@ def test_user_agent_custom(self, **kwargs): 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_name, "queue"), + credential=storage_account_key.secret, + user_agent=custom_app, ) def callback(response): @@ -580,7 +588,9 @@ def test_user_agent_append(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - service = QueueServiceClient(self.account_url(storage_account_name, "queue"), credential=storage_account_key) + service = QueueServiceClient( + self.account_url(storage_account_name, "queue"), credential=storage_account_key.secret + ) def callback(response): assert "User-Agent" in response.http_request.headers @@ -598,7 +608,7 @@ def test_create_queue_client_with_complete_queue_url(self, **kwargs): # Arrange queue_url = self.account_url(storage_account_name, "queue") + "/foo" - service = QueueClient(queue_url, queue_name="bar", credential=storage_account_key) + service = QueueClient(queue_url, queue_name="bar", credential=storage_account_key.secret) # Assert assert service.scheme == "https" @@ -627,7 +637,9 @@ def test_closing_pipeline_client(self, **kwargs): 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_name, "queue"), + credential=storage_account_key.secret, + queue_name="queue", ) # Assert @@ -644,7 +656,9 @@ def test_closing_pipeline_client_simple(self, **kwargs): 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_name, "queue"), + credential=storage_account_key.secret, + queue_name="queue", ) service.close() 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 3e3f5c2a504c..1a2366e8dc41 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 @@ -36,7 +36,7 @@ def validate_standard_account_endpoints(self, service, url_type, storage_account assert service is not None assert service.account_name == storage_account_name assert service.credential.account_name == storage_account_name - assert service.credential.account_key == storage_account_key + assert service.credential.account_key == storage_account_key.secret assert f"{storage_account_name}.{url_type}.core.windows.net" in service.url assert f"{storage_account_name}-secondary.{url_type}.core.windows.net" in service.secondary_endpoint @@ -63,7 +63,7 @@ def test_create_service_with_key(self, **kwargs): 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_name, "queue"), credential=storage_account_key.secret, queue_name="foo" ) # Assert @@ -78,7 +78,7 @@ def test_create_service_with_connection_string(self, **kwargs): for service_type in SERVICES.items(): # Act service = service_type[0].from_connection_string( - self.connection_string(storage_account_name, storage_account_key), queue_name="test" + self.connection_string(storage_account_name, storage_account_key.secret), queue_name="test" ) # Assert @@ -147,13 +147,13 @@ def test_create_service_china(self, **kwargs): for service_type in SERVICES.items(): # Act url = self.account_url(storage_account_name, "queue").replace("core.windows.net", "core.chinacloudapi.cn") - service = service_type[0](url, credential=storage_account_key, queue_name="foo") + service = service_type[0](url, credential=storage_account_key.secret, queue_name="foo") # Assert assert service is not None assert service.account_name == storage_account_name assert service.credential.account_name == storage_account_name - assert service.credential.account_key == storage_account_key + assert service.credential.account_key == storage_account_key.secret assert ( service.primary_endpoint.startswith( f"https://{storage_account_name}.{service_type[1]}.core.chinacloudapi.cn" @@ -177,7 +177,7 @@ def test_create_service_protocol(self, **kwargs): for service_type in SERVICES.items(): # Act url = self.account_url(storage_account_name, "queue").replace("https", "http") - service = service_type[0](url, credential=storage_account_key, queue_name="foo") + service = service_type[0](url, credential=storage_account_key.secret, queue_name="foo") # Assert self.validate_standard_account_endpoints( @@ -210,11 +210,11 @@ def test_create_service_with_socket_timeout(self, **kwargs): 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_name, "queue"), credential=storage_account_key.secret, queue_name="foo" ) service = service_type[0]( self.account_url(storage_account_name, "queue"), - credential=storage_account_key, + credential=storage_account_key.secret, queue_name="foo", connection_timeout=22, ) @@ -233,7 +233,7 @@ def test_create_service_with_connection_string_key(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - conn_string = f"AccountName={storage_account_name};" f"AccountKey={storage_account_key};" + conn_string = f"AccountName={storage_account_name};" f"AccountKey={storage_account_key.secret};" for service_type in SERVICES.items(): # Act service = service_type[0].from_connection_string(conn_string, queue_name="foo") @@ -271,7 +271,7 @@ def test_create_service_with_conn_str_endpoint_protocol(self, **kwargs): # Arrange conn_string = ( f"AccountName={storage_account_name};" - f"AccountKey={storage_account_key};" + f"AccountKey={storage_account_key.secret};" "DefaultEndpointsProtocol=http;EndpointSuffix=core.chinacloudapi.cn;" ) @@ -283,7 +283,7 @@ def test_create_service_with_conn_str_endpoint_protocol(self, **kwargs): assert service is not None assert service.account_name == storage_account_name assert service.credential.account_name == storage_account_name - assert service.credential.account_key == storage_account_key + assert service.credential.account_key == storage_account_key.secret assert ( service.primary_endpoint.startswith( f"http://{storage_account_name}.{service_type[1]}.core.chinacloudapi.cn/" @@ -321,7 +321,7 @@ def test_create_service_with_connection_string_custom_domain(self, **kwargs): for service_type in SERVICES.items(): conn_string = ( f"AccountName={storage_account_name};" - f"AccountKey={storage_account_key};" + f"AccountKey={storage_account_key.secret};" "QueueEndpoint=www.mydomain.com;" ) @@ -332,7 +332,7 @@ def test_create_service_with_connection_string_custom_domain(self, **kwargs): assert service is not None assert service.account_name == storage_account_name assert service.credential.account_name == storage_account_name - assert service.credential.account_key == storage_account_key + assert service.credential.account_key == storage_account_key.secret assert service.primary_endpoint.startswith("https://www.mydomain.com/") assert service.secondary_endpoint.startswith( f"https://{storage_account_name}-secondary.queue.core.windows.net" @@ -347,7 +347,7 @@ def test_create_serv_with_cs_custom_dmn_trlng_slash(self, **kwargs): for service_type in SERVICES.items(): conn_string = ( f"AccountName={storage_account_name};" - f"AccountKey={storage_account_key};" + f"AccountKey={storage_account_key.secret};" "QueueEndpoint=www.mydomain.com/;" ) @@ -358,7 +358,7 @@ def test_create_serv_with_cs_custom_dmn_trlng_slash(self, **kwargs): assert service is not None assert service.account_name == storage_account_name assert service.credential.account_name == storage_account_name - assert service.credential.account_key == storage_account_key + assert service.credential.account_key == storage_account_key.secret assert service.primary_endpoint.startswith("https://www.mydomain.com/") assert service.secondary_endpoint.startswith( f"https://{storage_account_name}-secondary.queue.core.windows.net" @@ -373,7 +373,7 @@ def test_create_service_with_cs_custom_dmn_sec_override(self, **kwargs): for service_type in SERVICES.items(): conn_string = ( f"AccountName={storage_account_name};" - f"AccountKey={storage_account_key};" + f"AccountKey={storage_account_key.secret};" "QueueEndpoint=www.mydomain.com/;" ) @@ -386,7 +386,7 @@ def test_create_service_with_cs_custom_dmn_sec_override(self, **kwargs): assert service is not None assert service.account_name == storage_account_name assert service.credential.account_name == storage_account_name - assert service.credential.account_key == storage_account_key + assert service.credential.account_key == storage_account_key.secret assert service.primary_endpoint.startswith("https://www.mydomain.com/") assert service.secondary_endpoint.startswith("https://www-sec.mydomain.com/") @@ -399,7 +399,7 @@ def test_create_service_with_cs_fails_if_sec_without_prim(self, **kwargs): # Arrange conn_string = ( f"AccountName={storage_account_name};" - f"AccountKey={storage_account_key};" + f"AccountKey={storage_account_key.secret};" f"{_CONNECTION_ENDPOINTS_SECONDARY.get(service_type[1])}=www.mydomain.com;" ) @@ -418,7 +418,7 @@ def test_create_service_with_cs_succeeds_if_sec_with_prim(self, **kwargs): # Arrange conn_string = ( f"AccountName={storage_account_name};" - f"AccountKey={storage_account_key};" + f"AccountKey={storage_account_key.secret};" f"{_CONNECTION_ENDPOINTS.get(service_type[1])}=www.mydomain.com;" f"{_CONNECTION_ENDPOINTS_SECONDARY.get(service_type[1])}=www-sec.mydomain.com;" ) @@ -430,7 +430,7 @@ def test_create_service_with_cs_succeeds_if_sec_with_prim(self, **kwargs): assert service is not None assert service.account_name == storage_account_name assert service.credential.account_name == storage_account_name - assert service.credential.account_key == storage_account_key + assert service.credential.account_key == storage_account_key.secret assert service.primary_endpoint.startswith("https://www.mydomain.com/") assert service.secondary_endpoint.startswith("https://www-sec.mydomain.com/") @@ -443,7 +443,7 @@ def test_create_service_with_custom_account_endpoint_path(self, **kwargs): for service_type in SERVICES.items(): conn_string = ( f"DefaultEndpointsProtocol=http;AccountName={storage_account_name};" - f"AccountKey={storage_account_key};" + f"AccountKey={storage_account_key.secret};" f"QueueEndpoint={custom_account_url};" ) @@ -453,7 +453,7 @@ def test_create_service_with_custom_account_endpoint_path(self, **kwargs): # Assert assert service.account_name == storage_account_name assert service.credential.account_name == storage_account_name - assert service.credential.account_key == storage_account_key + assert service.credential.account_key == storage_account_key.secret assert service.primary_hostname == "local-machine:11002/custom/account/path" service = QueueServiceClient(account_url=custom_account_url) @@ -483,7 +483,9 @@ async def test_request_callback_signed_header(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - service = QueueServiceClient(self.account_url(storage_account_name, "queue"), credential=storage_account_key) + service = QueueServiceClient( + self.account_url(storage_account_name, "queue"), credential=storage_account_key.secret + ) name = self.get_resource_name("cont") # Act @@ -505,7 +507,9 @@ async def test_response_callback(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - service = QueueServiceClient(self.account_url(storage_account_name, "queue"), credential=storage_account_key) + service = QueueServiceClient( + self.account_url(storage_account_name, "queue"), credential=storage_account_key.secret + ) name = self.get_resource_name("cont") queue = service.get_queue_client(name) @@ -523,7 +527,9 @@ async def test_user_agent_default(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - service = QueueServiceClient(self.account_url(storage_account_name, "queue"), credential=storage_account_key) + service = QueueServiceClient( + self.account_url(storage_account_name, "queue"), credential=storage_account_key.secret + ) def callback(response): assert "User-Agent" in response.http_request.headers @@ -539,7 +545,9 @@ async def test_user_agent_custom(self, **kwargs): 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_name, "queue"), + credential=storage_account_key.secret, + user_agent=custom_app, ) def callback(response): @@ -567,7 +575,9 @@ async def test_user_agent_append(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - service = QueueServiceClient(self.account_url(storage_account_name, "queue"), credential=storage_account_key) + service = QueueServiceClient( + self.account_url(storage_account_name, "queue"), credential=storage_account_key.secret + ) def callback(response): assert "User-Agent" in response.http_request.headers @@ -587,7 +597,9 @@ async def test_closing_pipeline_client(self, **kwargs): 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_name, "queue"), + credential=storage_account_key.secret, + queue_name="queue", ) # Assert @@ -604,7 +616,9 @@ async def test_closing_pipeline_client_simple(self, **kwargs): 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_name, "queue"), + credential=storage_account_key.secret, + queue_name="queue", ) await service.close() 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 4fd5d4818674..ac704c1b2bd8 100644 --- a/sdk/storage/azure-storage-queue/tests/test_queue_encodings.py +++ b/sdk/storage/azure-storage-queue/tests/test_queue_encodings.py @@ -66,7 +66,7 @@ def test_message_text_xml(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange. - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) message = "" queue = qsc.get_queue_client(self.get_resource_name(TEST_QUEUE_PREFIX)) @@ -82,7 +82,7 @@ def test_message_text_xml_whitespace(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange. - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) message = " mess\t age1\n" queue = qsc.get_queue_client(self.get_resource_name(TEST_QUEUE_PREFIX)) @@ -96,7 +96,7 @@ def test_message_text_xml_invalid_chars(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action. - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = self._get_queue_reference(qsc) message = "\u0001" @@ -111,11 +111,11 @@ def test_message_text_base64(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange. - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = QueueClient( account_url=self.account_url(storage_account_name, "queue"), queue_name=self.get_resource_name(TEST_QUEUE_PREFIX), - credential=storage_account_key, + credential=storage_account_key.secret, message_encode_policy=TextBase64EncodePolicy(), message_decode_policy=TextBase64DecodePolicy(), ) @@ -132,11 +132,11 @@ def test_message_bytes_base64(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange. - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = QueueClient( account_url=self.account_url(storage_account_name, "queue"), queue_name=self.get_resource_name(TEST_QUEUE_PREFIX), - credential=storage_account_key, + credential=storage_account_key.secret, message_encode_policy=BinaryBase64EncodePolicy(), message_decode_policy=BinaryBase64DecodePolicy(), ) @@ -153,7 +153,7 @@ def test_message_bytes_fails(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = qsc.get_queue_client(self.get_resource_name("failqueue")) queue.create_queue() @@ -175,11 +175,11 @@ def test_message_text_fails(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = QueueClient( account_url=self.account_url(storage_account_name, "queue"), queue_name=self.get_resource_name(TEST_QUEUE_PREFIX), - credential=storage_account_key, + credential=storage_account_key.secret, message_encode_policy=BinaryBase64EncodePolicy(), message_decode_policy=BinaryBase64DecodePolicy(), ) @@ -199,11 +199,11 @@ def test_message_base64_decode_fails(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = QueueClient( account_url=self.account_url(storage_account_name, "queue"), queue_name=self.get_resource_name(TEST_QUEUE_PREFIX), - credential=storage_account_key, + credential=storage_account_key.secret, message_encode_policy=None, message_decode_policy=BinaryBase64DecodePolicy(), ) 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 349d6cfc6ee9..90951d298e72 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 @@ -64,7 +64,7 @@ async def test_message_text_xml(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange. - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) message = "" queue = qsc.get_queue_client(self.get_resource_name(TEST_QUEUE_PREFIX)) @@ -78,7 +78,7 @@ async def test_message_text_xml_whitespace(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange. - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) message = " mess\t age1\n" queue = qsc.get_queue_client(self.get_resource_name(TEST_QUEUE_PREFIX)) @@ -92,7 +92,7 @@ async def test_message_text_xml_invalid_chars(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Action. - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = self._get_queue_reference(qsc) message = "\u0001" @@ -107,11 +107,11 @@ async def test_message_text_base64(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange. - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = QueueClient( account_url=self.account_url(storage_account_name, "queue"), queue_name=self.get_resource_name(TEST_QUEUE_PREFIX), - credential=storage_account_key, + credential=storage_account_key.secret, message_encode_policy=TextBase64EncodePolicy(), message_decode_policy=TextBase64DecodePolicy(), ) @@ -128,11 +128,11 @@ async def test_message_bytes_base64(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange. - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = QueueClient( account_url=self.account_url(storage_account_name, "queue"), queue_name=self.get_resource_name(TEST_QUEUE_PREFIX), - credential=storage_account_key, + credential=storage_account_key.secret, message_encode_policy=BinaryBase64EncodePolicy(), message_decode_policy=BinaryBase64DecodePolicy(), ) @@ -149,7 +149,7 @@ async def test_message_bytes_fails(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = await self._create_queue(qsc) # Action. with pytest.raises(TypeError) as e: @@ -169,11 +169,11 @@ async def test_message_text_fails(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = QueueClient( account_url=self.account_url(storage_account_name, "queue"), queue_name=self.get_resource_name(TEST_QUEUE_PREFIX), - credential=storage_account_key, + credential=storage_account_key.secret, message_encode_policy=BinaryBase64EncodePolicy(), message_decode_policy=BinaryBase64DecodePolicy(), ) @@ -193,11 +193,11 @@ async def test_message_base64_decode_fails(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = QueueClient( account_url=self.account_url(storage_account_name, "queue"), queue_name=self.get_resource_name(TEST_QUEUE_PREFIX), - credential=storage_account_key, + credential=storage_account_key.secret, message_encode_policy=None, message_decode_policy=BinaryBase64DecodePolicy(), ) 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 6b776d8e0cb6..9aab6293c2f7 100644 --- a/sdk/storage/azure-storage-queue/tests/test_queue_encryption.py +++ b/sdk/storage/azure-storage-queue/tests/test_queue_encryption.py @@ -78,7 +78,7 @@ def test_get_messages_encrypted_kek(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) qsc.key_encryption_key = KeyWrapper("key1") queue = self._create_queue(qsc) queue.send_message("encrypted_message_2") @@ -96,7 +96,7 @@ def test_get_messages_encrypted_resolver(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) qsc.key_encryption_key = KeyWrapper("key1") queue = self._create_queue(qsc) queue.send_message("encrypted_message_2") @@ -118,7 +118,7 @@ def test_peek_messages_encrypted_kek(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) qsc.key_encryption_key = KeyWrapper("key1") queue = self._create_queue(qsc) queue.send_message("encrypted_message_3") @@ -136,7 +136,7 @@ def test_peek_messages_encrypted_resolver(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) qsc.key_encryption_key = KeyWrapper("key1") queue = self._create_queue(qsc) queue.send_message("encrypted_message_4") @@ -161,7 +161,7 @@ def test_peek_messages_encrypted_kek_RSA(self, **kwargs): # 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_name, "queue"), storage_account_key.secret) qsc.key_encryption_key = RSAKeyWrapper("key2") queue = self._create_queue(qsc) queue.send_message("encrypted_message_3") @@ -179,7 +179,7 @@ def test_update_encrypted_message(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = self._create_queue(qsc) queue.key_encryption_key = KeyWrapper("key1") queue.send_message("Update Me") @@ -202,7 +202,7 @@ def test_update_encrypted_binary_message(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = self._create_queue( qsc, message_encode_policy=BinaryBase64EncodePolicy(), message_decode_policy=BinaryBase64DecodePolicy() ) @@ -234,7 +234,7 @@ def test_update_encrypted_raw_text_message(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = self._create_queue(qsc, message_encode_policy=None, message_decode_policy=None) queue.key_encryption_key = KeyWrapper("key1") @@ -260,7 +260,7 @@ def test_update_encrypted_json_message(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = self._create_queue(qsc, message_encode_policy=None, message_decode_policy=None) queue.key_encryption_key = KeyWrapper("key1") @@ -289,7 +289,7 @@ def test_invalid_value_kek_wrap(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = self._create_queue(qsc) queue.key_encryption_key = KeyWrapper("key1") queue.key_encryption_key.get_kid = None @@ -316,7 +316,7 @@ def test_missing_attribute_kek_wrap(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = self._create_queue(qsc) valid_key = KeyWrapper("key1") @@ -353,7 +353,7 @@ def test_invalid_value_kek_unwrap(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = self._create_queue(qsc) queue.key_encryption_key = KeyWrapper("key1") queue.send_message("message") @@ -374,7 +374,7 @@ def test_missing_attribute_kek_unwrap(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = self._create_queue(qsc) queue.key_encryption_key = KeyWrapper("key1") queue.send_message("message") @@ -404,7 +404,7 @@ def test_validate_encryption(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = self._create_queue(qsc) kek = KeyWrapper("key1") queue.key_encryption_key = kek @@ -468,7 +468,7 @@ def test_put_with_strict_mode(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = self._create_queue(qsc) kek = KeyWrapper("key1") queue.key_encryption_key = kek @@ -490,7 +490,7 @@ def test_get_with_strict_mode(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = self._create_queue(qsc) queue.send_message("message") @@ -508,7 +508,7 @@ def test_encryption_add_encrypted_64k_message(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = self._create_queue(qsc) message = "a" * 1024 * 64 @@ -527,7 +527,7 @@ def test_encryption_nonmatching_kid(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) queue = self._create_queue(qsc) queue.key_encryption_key = KeyWrapper("key1") queue.send_message("message") @@ -550,7 +550,7 @@ def test_get_message_encrypted_kek_v2(self, **kwargs): # Arrange qsc = QueueServiceClient( self.account_url(storage_account_name, "queue"), - storage_account_key, + storage_account_key.secret, require_encryption=True, encryption_version="2.0", key_encryption_key=KeyWrapper("key1"), @@ -574,7 +574,7 @@ def test_get_message_encrypted_resolver_v2(self, **kwargs): # Arrange qsc = QueueServiceClient( self.account_url(storage_account_name, "queue"), - storage_account_key, + storage_account_key.secret, require_encryption=True, encryption_version="2.0", key_encryption_key=KeyWrapper("key1"), @@ -607,7 +607,7 @@ def test_get_message_encrypted_kek_RSA_v2(self, **kwargs): # Arrange qsc = QueueServiceClient( self.account_url(storage_account_name, "queue"), - storage_account_key, + storage_account_key.secret, require_encryption=True, encryption_version="2.0", key_encryption_key=RSAKeyWrapper("key2"), @@ -631,7 +631,7 @@ def test_update_encrypted_message_v2(self, **kwargs): # Arrange qsc = QueueServiceClient( self.account_url(storage_account_name, "queue"), - storage_account_key, + storage_account_key.secret, requires_encryption=True, encryption_version="2.0", key_encryption_key=KeyWrapper("key1"), @@ -658,7 +658,7 @@ def test_update_encrypted_binary_message_v2(self, **kwargs): # Arrange qsc = QueueServiceClient( self.account_url(storage_account_name, "queue"), - storage_account_key, + storage_account_key.secret, requires_encryption=True, encryption_version="2.0", key_encryption_key=KeyWrapper("key1"), @@ -689,7 +689,7 @@ def test_encryption_v2_v1_downgrade(self, **kwargs): kek = KeyWrapper("key1") qsc = QueueServiceClient( self.account_url(storage_account_name, "queue"), - storage_account_key, + storage_account_key.secret, requires_encryption=True, encryption_version="2.0", key_encryption_key=kek, @@ -735,7 +735,7 @@ def test_validate_encryption_v2(self, **kwargs): kek = KeyWrapper("key1") qsc = QueueServiceClient( self.account_url(storage_account_name, "queue"), - storage_account_key, + storage_account_key.secret, require_encryption=True, encryption_version="2.0", key_encryption_key=kek, @@ -795,7 +795,7 @@ def assert_user_agent(request): # Test method level keyword qsc = QueueServiceClient( self.account_url(storage_account_name, "queue"), - storage_account_key, + storage_account_key.secret, require_encryption=True, encryption_version="2.0", key_encryption_key=kek, @@ -806,7 +806,7 @@ def assert_user_agent(request): # Test client constructor level keyword qsc = QueueServiceClient( self.account_url(storage_account_name, "queue"), - storage_account_key, + storage_account_key.secret, require_encryption=True, encryption_version="2.0", key_encryption_key=kek, 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 9872122ad7ed..05b881c686d8 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 @@ -72,7 +72,7 @@ async def test_get_messages_encrypted_kek(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) qsc.key_encryption_key = KeyWrapper("key1") queue = await self._create_queue(qsc) await queue.send_message("encrypted_message_2") @@ -92,7 +92,7 @@ async def test_get_messages_encrypted_resolver(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) qsc.key_encryption_key = KeyWrapper("key1") queue = await self._create_queue(qsc) await queue.send_message("encrypted_message_2") @@ -115,7 +115,7 @@ async def test_peek_messages_encrypted_kek(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Arrange qsc.key_encryption_key = KeyWrapper("key1") queue = await self._create_queue(qsc) @@ -133,7 +133,7 @@ async def test_peek_messages_encrypted_resolver(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Arrange qsc.key_encryption_key = KeyWrapper("key1") queue = await self._create_queue(qsc) @@ -155,7 +155,7 @@ async def test_peek_messages_encrypted_kek_RSA(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # 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. @@ -176,7 +176,7 @@ async def test_update_encrypted_message(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Arrange queue = await self._create_queue(qsc) queue.key_encryption_key = KeyWrapper("key1") @@ -203,7 +203,7 @@ async def test_update_encrypted_binary_message(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Arrange queue = await self._create_queue( qsc, message_encode_policy=BinaryBase64EncodePolicy(), message_decode_policy=BinaryBase64DecodePolicy() @@ -235,7 +235,7 @@ async def test_update_encrypted_raw_text_message(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Arrange queue = await self._create_queue(qsc, message_encode_policy=None, message_decode_policy=None) queue.key_encryption_key = KeyWrapper("key1") @@ -263,7 +263,7 @@ async def test_update_encrypted_json_message(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Arrange queue = await self._create_queue(qsc, message_encode_policy=None, message_decode_policy=None) queue.key_encryption_key = KeyWrapper("key1") @@ -296,7 +296,7 @@ async def test_invalid_value_kek_wrap(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Arrange queue = await self._create_queue(qsc) queue.key_encryption_key = KeyWrapper("key1") @@ -323,7 +323,7 @@ async def test_missing_attribute_kek_wrap(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Arrange queue = await self._create_queue(qsc) @@ -360,7 +360,7 @@ async def test_invalid_value_kek_unwrap(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Arrange queue = await self._create_queue(qsc) queue.key_encryption_key = KeyWrapper("key1") @@ -381,7 +381,7 @@ async def test_missing_attribute_kek_unwrap(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Arrange queue = await self._create_queue(qsc) queue.key_encryption_key = KeyWrapper("key1") @@ -411,7 +411,7 @@ async def test_validate_encryption(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Arrange queue = await self._create_queue(qsc) kek = KeyWrapper("key1") @@ -475,7 +475,7 @@ async def test_put_with_strict_mode(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Arrange queue = await self._create_queue(qsc) kek = KeyWrapper("key1") @@ -497,7 +497,7 @@ async def test_get_with_strict_mode(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Arrange queue = await self._create_queue(qsc) await queue.send_message("message") @@ -517,7 +517,7 @@ async def test_encryption_add_encrypted_64k_message(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Arrange queue = await self._create_queue(qsc) message = "a" * 1024 * 64 @@ -536,7 +536,7 @@ async def test_encryption_nonmatching_kid(self, **kwargs): storage_account_name = kwargs.pop("storage_account_name") storage_account_key = kwargs.pop("storage_account_key") - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Arrange queue = await self._create_queue(qsc) queue.key_encryption_key = KeyWrapper("key1") @@ -562,7 +562,7 @@ async def test_get_message_encrypted_kek_v2(self, **kwargs): # Arrange qsc = QueueServiceClient( self.account_url(storage_account_name, "queue"), - storage_account_key, + storage_account_key.secret, require_encryption=True, encryption_version="2.0", key_encryption_key=KeyWrapper("key1"), @@ -586,7 +586,7 @@ async def test_get_message_encrypted_resolver_v2(self, **kwargs): # Arrange qsc = QueueServiceClient( self.account_url(storage_account_name, "queue"), - storage_account_key, + storage_account_key.secret, require_encryption=True, encryption_version="2.0", key_encryption_key=KeyWrapper("key1"), @@ -619,7 +619,7 @@ async def test_get_message_encrypted_kek_RSA_v2(self, **kwargs): # Arrange qsc = QueueServiceClient( self.account_url(storage_account_name, "queue"), - storage_account_key, + storage_account_key.secret, require_encryption=True, encryption_version="2.0", key_encryption_key=RSAKeyWrapper("key2"), @@ -643,7 +643,7 @@ async def test_update_encrypted_message_v2(self, **kwargs): # Arrange qsc = QueueServiceClient( self.account_url(storage_account_name, "queue"), - storage_account_key, + storage_account_key.secret, require_encryption=True, encryption_version="2.0", key_encryption_key=KeyWrapper("key1"), @@ -670,7 +670,7 @@ async def test_update_encrypted_binary_message_v2(self, **kwargs): # Arrange qsc = QueueServiceClient( self.account_url(storage_account_name, "queue"), - storage_account_key, + storage_account_key.secret, requires_encryption=True, encryption_version="2.0", key_encryption_key=KeyWrapper("key1"), @@ -701,7 +701,7 @@ async def test_encryption_v2_v1_downgrade(self, **kwargs): kek = KeyWrapper("key1") qsc = QueueServiceClient( self.account_url(storage_account_name, "queue"), - storage_account_key, + storage_account_key.secret, requires_encryption=True, encryption_version="2.0", key_encryption_key=kek, @@ -747,7 +747,7 @@ async def test_validate_encryption_v2(self, **kwargs): kek = KeyWrapper("key1") qsc = QueueServiceClient( self.account_url(storage_account_name, "queue"), - storage_account_key, + storage_account_key.secret, require_encryption=True, encryption_version="2.0", key_encryption_key=kek, @@ -807,7 +807,7 @@ def assert_user_agent(request): # Test method level keyword qsc = QueueServiceClient( self.account_url(storage_account_name, "queue"), - storage_account_key, + storage_account_key.secret, require_encryption=True, encryption_version="2.0", key_encryption_key=kek, @@ -818,7 +818,7 @@ def assert_user_agent(request): # Test client constructor level keyword qsc = QueueServiceClient( self.account_url(storage_account_name, "queue"), - storage_account_key, + storage_account_key.secret, require_encryption=True, encryption_version="2.0", key_encryption_key=kek, 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 d84b0ad05843..6d154ecf46a2 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 @@ -103,7 +103,7 @@ def test_queue_service_properties(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Act resp = qsc.set_service_properties( analytics_logging=QueueAnalyticsLogging(), hour_metrics=Metrics(), minute_metrics=Metrics(), cors=[] @@ -122,7 +122,7 @@ def test_set_logging(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) logging = QueueAnalyticsLogging( read=True, write=True, delete=True, retention_policy=RetentionPolicy(enabled=True, days=5) ) @@ -141,7 +141,7 @@ def test_set_hour_metrics(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) hour_metrics = Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=5)) # Act @@ -158,7 +158,7 @@ def test_set_minute_metrics(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) minute_metrics = Metrics( enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=5) ) @@ -177,7 +177,7 @@ def test_set_cors(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) cors_rule1 = CorsRule(["www.xyz.com"], ["GET"]) allowed_origins = ["www.xyz.com", "www.ab.com", "www.bc.com"] @@ -218,7 +218,7 @@ def test_too_many_cors_rules(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) cors = [] for i in range(0, 6): cors.append(CorsRule(["www.xyz.com"], ["GET"])) @@ -233,7 +233,7 @@ def test_retention_too_long(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) 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 7e870420898b..f8bb7e39231e 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 @@ -99,7 +99,7 @@ async def test_queue_service_properties(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Act resp = await qsc.set_service_properties( @@ -119,7 +119,7 @@ async def test_set_logging(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) logging = QueueAnalyticsLogging( read=True, write=True, delete=True, retention_policy=RetentionPolicy(enabled=True, days=5) ) @@ -138,7 +138,7 @@ async def test_set_hour_metrics(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) hour_metrics = Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=5)) # Act @@ -155,7 +155,7 @@ async def test_set_minute_metrics(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) minute_metrics = Metrics( enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=5) ) @@ -174,7 +174,7 @@ async def test_set_cors(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) cors_rule1 = CorsRule(["www.xyz.com"], ["GET"]) allowed_origins = ["www.xyz.com", "www.ab.com", "www.bc.com"] @@ -207,7 +207,7 @@ async def test_retention_no_days(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Assert - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) pytest.raises(ValueError, RetentionPolicy, True, None) @QueuePreparer() @@ -217,7 +217,7 @@ async def test_too_many_cors_rules(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) cors = [] for _ in range(0, 6): cors.append(CorsRule(["www.xyz.com"], ["GET"])) @@ -233,7 +233,7 @@ async def test_retention_too_long(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) 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 21b5caaa3815..6c07b58a264c 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 @@ -40,7 +40,7 @@ def test_queue_service_stats(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Act stats = qsc.get_service_stats() @@ -55,7 +55,7 @@ def test_queue_service_stats_when_unavailable(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # 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 cc9e2a5de7cc..23a0f0ade37e 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 @@ -40,7 +40,7 @@ async def test_queue_service_stats(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Act stats = await qsc.get_service_stats() @@ -55,7 +55,7 @@ async def test_queue_service_stats_when_unavailable(self, **kwargs): storage_account_key = kwargs.pop("storage_account_key") # Arrange - qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key) + qsc = QueueServiceClient(self.account_url(storage_account_name, "queue"), storage_account_key.secret) # Act stats = await qsc.get_service_stats()