From 4aaa88ad743dcd0e1a857de6e924b306146f9880 Mon Sep 17 00:00:00 2001
From: Sean Kane <68240067+seankane-msft@users.noreply.github.com>
Date: Wed, 5 May 2021 11:50:16 -0400
Subject: [PATCH] [Tables] Adds support for AzureNamedKeyCredential (#18456)
#18441
---
sdk/tables/azure-data-tables/CHANGELOG.md | 2 +
.../azure/data/tables/_authentication.py | 25 +-
.../azure/data/tables/_base_client.py | 29 +-
.../data/tables/_shared_access_signature.py | 12 +-
.../azure/data/tables/_table_client.py | 7 +-
.../data/tables/_table_service_client.py | 4 +-
.../tables/_table_shared_access_signature.py | 34 +-
.../data/tables/aio/_base_client_async.py | 14 +-
.../data/tables/aio/_table_client_async.py | 14 +-
.../sample_authentication_async.py | 6 +-
.../async_samples/sample_batching_async.py | 1 -
.../sample_create_client_async.py | 1 -
.../sample_create_delete_table_async.py | 1 -
.../sample_insert_delete_entities_async.py | 7 +-
.../async_samples/sample_query_table_async.py | 1 -
.../samples/sample_authentication.py | 10 +-
.../samples/sample_batching.py | 1 -
.../samples/sample_create_client.py | 7 +-
.../samples/sample_create_delete_table.py | 1 -
.../samples/sample_insert_delete_entities.py | 6 +-
sdk/tables/azure-data-tables/setup.py | 2 +-
.../tests/_shared/testcase.py | 5 +-
.../tests/async_preparers.py | 47 +++
.../azure-data-tables/tests/preparers.py | 58 ++-
.../test_table_batch.test_batch_sas_auth.yaml | 345 +++++++++++-------
...test_table_batch.test_new_invalid_key.yaml | 56 ++-
.../azure-data-tables/tests/test_retry.py | 14 +-
.../tests/test_retry_async.py | 14 +-
.../azure-data-tables/tests/test_table.py | 54 +--
.../tests/test_table_async.py | 48 +--
.../tests/test_table_batch.py | 56 +--
.../tests/test_table_batch_async.py | 40 +-
.../tests/test_table_batch_cosmos.py | 30 +-
.../tests/test_table_batch_cosmos_async.py | 34 +-
.../tests/test_table_client.py | 143 ++++----
.../tests/test_table_client_async.py | 133 ++++---
.../tests/test_table_client_cosmos.py | 75 ++--
.../tests/test_table_client_cosmos_async.py | 71 ++--
.../tests/test_table_cosmos.py | 29 +-
.../tests/test_table_cosmos_async.py | 29 +-
.../tests/test_table_entity.py | 178 ++++-----
.../tests/test_table_entity_async.py | 164 ++++-----
.../tests/test_table_entity_cosmos.py | 141 ++++---
.../tests/test_table_entity_cosmos_async.py | 136 +++----
.../tests/test_table_service_properties.py | 16 +-
.../test_table_service_properties_async.py | 16 +-
.../test_table_service_properties_cosmos.py | 6 +-
...t_table_service_properties_cosmos_async.py | 6 +-
.../tests/test_table_service_stats.py | 6 +-
.../tests/test_table_service_stats_async.py | 6 +-
.../tests/test_table_service_stats_cosmos.py | 6 +-
.../test_table_service_stats_cosmos_async.py | 6 +-
shared_requirements.txt | 2 +-
53 files changed, 1146 insertions(+), 1009 deletions(-)
create mode 100644 sdk/tables/azure-data-tables/tests/async_preparers.py
diff --git a/sdk/tables/azure-data-tables/CHANGELOG.md b/sdk/tables/azure-data-tables/CHANGELOG.md
index 8f69a1d3a20f..5a71a3aa42e9 100644
--- a/sdk/tables/azure-data-tables/CHANGELOG.md
+++ b/sdk/tables/azure-data-tables/CHANGELOG.md
@@ -15,9 +15,11 @@
* Changed optional `value` and `type` arguments of `EntityProperty` to required.
* Renamed `EntityProperty.type` to `EntityProperty.edm_type`.
* `BatchErrorException` has been renamed to `TableTransactionError`.
+* The only supported credentials are `AzureNamedKeyCredential`, `AzureSasCredential`, or authentication by connection string
* `EntityProperty` is now a tuple.
* Removed `date` and `api_version` from the `TableItem` class.
+
**Fixes**
* Fixed issue with Cosmos merge operations.
* Removed legacy Storage policies from pipeline.
diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_authentication.py b/sdk/tables/azure-data-tables/azure/data/tables/_authentication.py
index b0dfbd5d56e0..e6aafa709cc4 100644
--- a/sdk/tables/azure-data-tables/azure/data/tables/_authentication.py
+++ b/sdk/tables/azure-data-tables/azure/data/tables/_authentication.py
@@ -5,6 +5,8 @@
# --------------------------------------------------------------------------
import logging
+import sys
+from typing import Union
try:
from urllib.parse import urlparse
@@ -32,6 +34,9 @@
_wrap_exception,
)
+if sys.version_info > (3, 5):
+ from typing import Awaitable # pylint: disable=ungrouped-imports
+
logger = logging.getLogger(__name__)
@@ -45,11 +50,8 @@ class AzureSigningError(ClientAuthenticationError):
# pylint: disable=no-self-use
class SharedKeyCredentialPolicy(SansIOHTTPPolicy):
- def __init__(
- self, account_name, account_key, is_emulated=False
- ):
- self.account_name = account_name
- self.account_key = account_key
+ def __init__(self, credential, is_emulated=False):
+ self._credential = credential
self.is_emulated = is_emulated
def _get_headers(self, request, headers_to_sign):
@@ -82,10 +84,10 @@ def _get_canonicalized_resource(self, request):
)
):
uri_path = URL(uri_path)
- return "/" + self.account_name + str(uri_path)
+ return "/" + self._credential.named_key.name + str(uri_path)
except TypeError:
pass
- return "/" + self.account_name + uri_path
+ return "/" + self._credential.named_key.name + uri_path
def _get_canonicalized_headers(self, request):
string_to_sign = ""
@@ -101,17 +103,16 @@ def _get_canonicalized_headers(self, request):
def _add_authorization_header(self, request, string_to_sign):
try:
- signature = _sign_string(self.account_key, string_to_sign)
- auth_string = "SharedKey " + self.account_name + ":" + signature
+ signature = _sign_string(self._credential.named_key.key, string_to_sign)
+ auth_string = "SharedKey " + self._credential.named_key.name + ":" + signature
request.headers["Authorization"] = auth_string
except Exception as ex:
# Wrap any error that occurred as signing error
# Doing so will clarify/locate the source of problem
raise _wrap_exception(ex, AzureSigningError)
- def on_request(
- self, request
- ): # type: (PipelineRequest) -> Union[None, Awaitable[None]]
+ def on_request(self, request):
+ # type: (PipelineRequest) -> Union[None, Awaitable[None]]
self.sign_request(request)
def sign_request(self, request):
diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_base_client.py b/sdk/tables/azure-data-tables/azure/data/tables/_base_client.py
index f5984ccdf4dc..c6c23470b01f 100644
--- a/sdk/tables/azure-data-tables/azure/data/tables/_base_client.py
+++ b/sdk/tables/azure-data-tables/azure/data/tables/_base_client.py
@@ -13,7 +13,7 @@
from urllib2 import quote # type: ignore
import six
-from azure.core.credentials import AzureSasCredential
+from azure.core.credentials import AzureSasCredential, AzureNamedKeyCredential
from azure.core.utils import parse_connection_string
from azure.core.pipeline.transport import (
HttpTransport,
@@ -30,7 +30,7 @@
AzureSasCredentialPolicy,
NetworkTraceLoggingPolicy,
CustomHookPolicy,
- RequestIdPolicy
+ RequestIdPolicy,
)
from ._generated import AzureTable
@@ -111,7 +111,7 @@ def __init__(
self.account_name = account[0] if len(account) > 1 else None
secondary_hostname = None
- self.credential = format_shared_key_credential(account, credential)
+ self.credential = credential
if self.scheme.lower() != "https" and hasattr(self.credential, "get_token"):
raise ValueError("Token credential is only supported with HTTPS.")
if hasattr(self.credential, "account_name"):
@@ -259,6 +259,8 @@ def _configure_credential(self, credential):
self._credential_policy = credential
elif isinstance(credential, AzureSasCredential):
self._credential_policy = AzureSasCredentialPolicy(credential)
+ elif isinstance(credential, AzureNamedKeyCredential):
+ self._credential_policy = SharedKeyCredentialPolicy(credential)
elif credential is not None:
raise TypeError("Unsupported credential: {}".format(credential))
@@ -344,32 +346,13 @@ def __exit__(self, *args): # pylint: disable=arguments-differ
pass
-def format_shared_key_credential(account, credential):
- if isinstance(credential, six.string_types):
- if len(account) < 2:
- raise ValueError(
- "Unable to determine account name for shared key credential."
- )
- credential = {"account_name": account[0], "account_key": credential}
- if isinstance(credential, dict):
- if "account_name" not in credential:
- raise ValueError("Shared key credential missing 'account_name")
- if "account_key" not in credential:
- raise ValueError("Shared key credential missing 'account_key")
- return SharedKeyCredentialPolicy(**credential)
- return credential
-
-
def parse_connection_str(conn_str, credential, keyword_args):
conn_settings = parse_connection_string(conn_str)
primary = None
secondary = None
if not credential:
try:
- credential = {
- "account_name": conn_settings["accountname"],
- "account_key": conn_settings["accountkey"],
- }
+ credential = AzureNamedKeyCredential(name=conn_settings["accountname"], key=conn_settings["accountkey"])
except KeyError:
credential = conn_settings.get("sharedaccesssignature")
# if "sharedaccesssignature" in conn_settings:
diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_shared_access_signature.py b/sdk/tables/azure-data-tables/azure/data/tables/_shared_access_signature.py
index 55e0f3a41075..c3d1607a5f66 100644
--- a/sdk/tables/azure-data-tables/azure/data/tables/_shared_access_signature.py
+++ b/sdk/tables/azure-data-tables/azure/data/tables/_shared_access_signature.py
@@ -28,17 +28,15 @@ class SharedAccessSignature(object):
generate_*_shared_access_signature method directly.
"""
- def __init__(self, account_name, account_key, x_ms_version=DEFAULT_X_MS_VERSION):
+ def __init__(self, credential, x_ms_version=DEFAULT_X_MS_VERSION):
"""
- :param str account_name:
- The storage account name used to generate the shared access signatures.
- :param str account_key:
- The access key to generate the shares access signatures.
+ :param credential: The credential used for authenticating requests
+ :type credential: :class:`~azure.core.credentials.NamedKeyCredential`
:param str x_ms_version:
The service version used to generate the shared access signatures.
"""
- self.account_name = account_name
- self.account_key = account_key
+ self.account_name = credential.named_key.name
+ self.account_key = credential.named_key.key
self.x_ms_version = x_ms_version
def generate_account(
diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py b/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py
index fe3b62db99d7..2814d34cfc03 100644
--- a/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py
+++ b/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py
@@ -50,7 +50,7 @@ def __init__(
self,
account_url, # type: str
table_name, # type: str
- credential=None, # type: str
+ credential=None, # type: Union[AzureNamedKeyCredential, AzureSasCredential]
**kwargs # type: Any
):
# type: (...) -> None
@@ -66,8 +66,9 @@ def __init__(
account URL already has a SAS token, or the connection string already has shared
access key values. The value can be a SAS token string or an account shared access
key.
- :type credential: str
-
+ :type credential:
+ :class:`~azure.core.credentials.AzureNamedKeyCredential` or
+ :class:`~azure.core.credentials.AzureSasCredential`
:returns: None
"""
if not table_name:
diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_table_service_client.py b/sdk/tables/azure-data-tables/azure/data/tables/_table_service_client.py
index c80e1c54d238..e2f4b484d77d 100644
--- a/sdk/tables/azure-data-tables/azure/data/tables/_table_service_client.py
+++ b/sdk/tables/azure-data-tables/azure/data/tables/_table_service_client.py
@@ -36,7 +36,9 @@ class TableServiceClient(TablesBaseClient):
account URL already has a SAS token, or the connection string already has shared
access key values. The value can be a SAS token string or an account shared access
key.
- :type credential: str
+ :type credential:
+ :class:`~azure.core.credentials.AzureNamedKeyCredential` or
+ :class:`~azure.core.credentials.AzureSasCredential`
:returns: None
.. admonition:: Example:
diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_table_shared_access_signature.py b/sdk/tables/azure-data-tables/azure/data/tables/_table_shared_access_signature.py
index f8d1306fa053..970d801dbaa1 100644
--- a/sdk/tables/azure-data-tables/azure/data/tables/_table_shared_access_signature.py
+++ b/sdk/tables/azure-data-tables/azure/data/tables/_table_shared_access_signature.py
@@ -3,7 +3,7 @@
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
-from typing import Union
+from typing import Union, Any
from ._models import AccountSasPermissions
from ._common_conversion import _sign_string
@@ -17,8 +17,7 @@
def generate_account_sas(
- account_name, # type:str
- account_key, # type:str
+ credential, # type: AzureNamedKeyCredential
resource_types, # type:ResourceTypes
permission, # type:Union[str,AccountSasPermissions]
expiry, # type:Union[datetime,str]
@@ -29,10 +28,8 @@ def generate_account_sas(
Generates a shared access signature for the table service.
Use the returned signature with the sas_token parameter of TableService.
- :param account_name: Account name
- :type account_name: str
- :param account_key: Account key
- :type account_key: str
+ :param credential: Credential for the Azure account
+ :type credential: :class:`~azure.core.credentials.AzureNamedKeyCredential`
:param resource_types:
Specifies the resource types that are accessible with the account SAS.
:type resource_types: ResourceTypes
@@ -70,11 +67,11 @@ def generate_account_sas(
:return: A Shared Access Signature (sas) token.
:rtype: str
"""
- _validate_not_none("account_name", account_name)
- _validate_not_none("account_key", account_key)
+ _validate_not_none("account_name", credential.named_key.name)
+ _validate_not_none("account_key", credential.named_key.key)
if permission is str:
permission = AccountSasPermissions.from_string(permission=permission)
- sas = TableSharedAccessSignature(account_name, account_key)
+ sas = TableSharedAccessSignature(credential)
return sas.generate_account(
"t",
resource_types,
@@ -87,8 +84,7 @@ def generate_account_sas(
def generate_table_sas(
- account_name, # type: str
- account_key, # type: str
+ credential, # type: AzureNamedKeyCredential
table_name, # type: str
**kwargs # type: Any
): # type: (...) -> str
@@ -143,7 +139,7 @@ def generate_table_sas(
:rtype: str
"""
- sas = TableSharedAccessSignature(account_name, account_key)
+ sas = TableSharedAccessSignature(credential)
return sas.generate_table(
table_name=table_name,
permission=kwargs.pop("permission", None),
@@ -168,17 +164,13 @@ class TableSharedAccessSignature(SharedAccessSignature):
generate_*_shared_access_signature method directly.
"""
- def __init__(self, account_name, account_key):
+ def __init__(self, credential):
"""
- :param account_name:
- The storage account name used to generate the shared access signatures.
- :type account_name: str
- :param account_key:
- The access key to generate the shares access signatures.
- :type account_key: str
+ :param credential: The credential used for authenticating requests
+ :type credential: :class:`~azure.core.credentials.NamedKeyCredential`
"""
super(TableSharedAccessSignature, self).__init__(
- account_name, account_key, x_ms_version=X_MS_VERSION
+ credential, x_ms_version=X_MS_VERSION
)
def generate_table(
diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_base_client_async.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_base_client_async.py
index 800d46aeba5d..4f87d4ba5567 100644
--- a/sdk/tables/azure-data-tables/azure/data/tables/aio/_base_client_async.py
+++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_base_client_async.py
@@ -4,10 +4,10 @@
# license information.
# --------------------------------------------------------------------------
-from typing import Any, List, Mapping
+from typing import Any, List, Mapping, Optional, Union
from uuid import uuid4
-from azure.core.credentials import AzureSasCredential
+from azure.core.credentials import AzureSasCredential, AzureNamedKeyCredential
from azure.core.pipeline.policies import (
ContentDecodePolicy,
AsyncBearerTokenCredentialPolicy,
@@ -19,7 +19,7 @@
AzureSasCredentialPolicy,
RequestIdPolicy,
CustomHookPolicy,
- NetworkTraceLoggingPolicy
+ NetworkTraceLoggingPolicy,
)
from azure.core.pipeline.transport import (
AsyncHttpTransport,
@@ -40,9 +40,9 @@ class AsyncTablesBaseClient(AccountHostsMixin):
def __init__(
self,
- account_url, # type: str
- credential=None, # type: str
- **kwargs # type: Any
+ account_url: str,
+ credential: Optional[Union[AzureSasCredential, AzureNamedKeyCredential]] = None,
+ **kwargs: Any
):
# type: (...) -> None
super(AsyncTablesBaseClient, self).__init__(account_url, credential=credential, **kwargs)
@@ -77,6 +77,8 @@ def _configure_credential(self, credential):
self._credential_policy = credential
elif isinstance(credential, AzureSasCredential):
self._credential_policy = AzureSasCredentialPolicy(credential)
+ elif isinstance(credential, AzureNamedKeyCredential):
+ self._credential_policy = SharedKeyCredentialPolicy(credential)
elif credential is not None:
raise TypeError("Unsupported credential: {}".format(credential))
diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py
index 4e27e37b16c9..2fc44964aed4 100644
--- a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py
+++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py
@@ -11,7 +11,7 @@
from urlparse import urlparse # type: ignore
from urllib2 import unquote # type: ignore
-from azure.core.credentials import AzureSasCredential
+from azure.core.credentials import AzureNamedKeyCredential, AzureSasCredential
from azure.core.async_paging import AsyncItemPaged
from azure.core.exceptions import ResourceNotFoundError, HttpResponseError
from azure.core.tracing.decorator import distributed_trace
@@ -43,7 +43,7 @@ def __init__(
self,
account_url: str,
table_name: str,
- credential: Optional[Union[AzureSasCredential]] = None,
+ credential: Optional[Union[AzureSasCredential, AzureNamedKeyCredential]] = None,
**kwargs
) -> None:
"""Create TableClient from a Credential.
@@ -58,7 +58,9 @@ def __init__(
account URL already has a SAS token, or the connection string already has shared
access key values. The value can be a SAS token string or an account shared access
key.
- :type credential: str
+ :type credential:
+ :class:`~azure.core.credentials.AzureNamedKeyCredential` or
+ :class:`~azure.core.credentials.AzureSasCredential`
:returns: None
"""
@@ -109,7 +111,7 @@ def from_connection_string(
def from_table_url(
cls,
table_url: str,
- credential: Optional[Union[AzureSasCredential]] = None,
+ credential: Optional[Union[AzureSasCredential, AzureNamedKeyCredential]] = None,
**kwargs
) -> 'TableClient':
"""A client to interact with a specific Table.
@@ -120,7 +122,9 @@ def from_table_url(
The credentials with which to authenticate. This is optional if the
account URL already has a SAS token. The value can be a SAS token string, an account
shared access key.
- :type credential: str
+ :type credential:
+ :class:`~azure.core.credentials.AzureNamedKeyCredential` or
+ :class:`~azure.core.credentials.AzureSasCredential`
:returns: A table client.
:rtype: :class:`~azure.data.tables.TableClient`
"""
diff --git a/sdk/tables/azure-data-tables/samples/async_samples/sample_authentication_async.py b/sdk/tables/azure-data-tables/samples/async_samples/sample_authentication_async.py
index c29e6233cdb2..4146cf9186b4 100644
--- a/sdk/tables/azure-data-tables/samples/async_samples/sample_authentication_async.py
+++ b/sdk/tables/azure-data-tables/samples/async_samples/sample_authentication_async.py
@@ -37,7 +37,6 @@ class TableAuthSamples(object):
def __init__(self):
load_dotenv(find_dotenv())
- # self.connection_string = os.getenv("AZURE_TABLES_CONNECTION_STRING")
self.access_key = os.getenv("TABLES_PRIMARY_STORAGE_ACCOUNT_KEY")
self.endpoint = os.getenv("TABLES_STORAGE_ENDPOINT_SUFFIX")
self.account_name = os.getenv("TABLES_STORAGE_ACCOUNT_NAME")
@@ -70,13 +69,14 @@ async def authentication_by_shared_access_signature(self):
# Instantiate a TableServiceClient using a connection string
# [START auth_by_sas]
from azure.data.tables.aio import TableServiceClient
+ from azure.core.credentials import AzureNamedKeyCredential
# Create a SAS token to use for authentication of a client
from azure.data.tables import generate_account_sas, ResourceTypes, AccountSasPermissions
print("Account name: {}".format(self.account_name))
+ credential = AzureNamedKeyCredential(self.account_name, self.access_key)
sas_token = generate_account_sas(
- self.account_name,
- self.access_key,
+ credential,
resource_types=ResourceTypes(service=True),
permission=AccountSasPermissions(read=True),
expiry=datetime.utcnow() + timedelta(hours=1)
diff --git a/sdk/tables/azure-data-tables/samples/async_samples/sample_batching_async.py b/sdk/tables/azure-data-tables/samples/async_samples/sample_batching_async.py
index 3398f740c83f..e29a70c8202a 100644
--- a/sdk/tables/azure-data-tables/samples/async_samples/sample_batching_async.py
+++ b/sdk/tables/azure-data-tables/samples/async_samples/sample_batching_async.py
@@ -32,7 +32,6 @@ class CreateClients(object):
def __init__(self):
load_dotenv(find_dotenv())
- # self.connection_string = os.getenv("AZURE_TABLES_CONNECTION_STRING")
self.access_key = os.getenv("TABLES_PRIMARY_STORAGE_ACCOUNT_KEY")
self.endpoint = os.getenv("TABLES_STORAGE_ENDPOINT_SUFFIX")
self.account_name = os.getenv("TABLES_STORAGE_ACCOUNT_NAME")
diff --git a/sdk/tables/azure-data-tables/samples/async_samples/sample_create_client_async.py b/sdk/tables/azure-data-tables/samples/async_samples/sample_create_client_async.py
index 6ba620eca67b..00780a7bac34 100644
--- a/sdk/tables/azure-data-tables/samples/async_samples/sample_create_client_async.py
+++ b/sdk/tables/azure-data-tables/samples/async_samples/sample_create_client_async.py
@@ -37,7 +37,6 @@ class CreateClients(object):
def __init__(self):
load_dotenv(find_dotenv())
- # self.connection_string = os.getenv("AZURE_TABLES_CONNECTION_STRING")
self.access_key = os.getenv("TABLES_PRIMARY_STORAGE_ACCOUNT_KEY")
self.endpoint = os.getenv("TABLES_STORAGE_ENDPOINT_SUFFIX")
self.account_name = os.getenv("TABLES_STORAGE_ACCOUNT_NAME")
diff --git a/sdk/tables/azure-data-tables/samples/async_samples/sample_create_delete_table_async.py b/sdk/tables/azure-data-tables/samples/async_samples/sample_create_delete_table_async.py
index 614c04c17e8e..2738a9220f78 100644
--- a/sdk/tables/azure-data-tables/samples/async_samples/sample_create_delete_table_async.py
+++ b/sdk/tables/azure-data-tables/samples/async_samples/sample_create_delete_table_async.py
@@ -33,7 +33,6 @@ class CreateDeleteTable(object):
def __init__(self):
load_dotenv(find_dotenv())
- # self.connection_string = os.getenv("AZURE_TABLES_CONNECTION_STRING")
self.access_key = os.getenv("TABLES_PRIMARY_STORAGE_ACCOUNT_KEY")
self.endpoint = os.getenv("TABLES_STORAGE_ENDPOINT_SUFFIX")
self.account_name = os.getenv("TABLES_STORAGE_ACCOUNT_NAME")
diff --git a/sdk/tables/azure-data-tables/samples/async_samples/sample_insert_delete_entities_async.py b/sdk/tables/azure-data-tables/samples/async_samples/sample_insert_delete_entities_async.py
index 1fa6febf5e0f..daf1401138e3 100644
--- a/sdk/tables/azure-data-tables/samples/async_samples/sample_insert_delete_entities_async.py
+++ b/sdk/tables/azure-data-tables/samples/async_samples/sample_insert_delete_entities_async.py
@@ -21,7 +21,6 @@
"""
import os
-from time import sleep
import asyncio
from dotenv import find_dotenv, load_dotenv
@@ -29,7 +28,6 @@ class InsertDeleteEntity(object):
def __init__(self):
load_dotenv(find_dotenv())
- # self.connection_string = os.getenv("AZURE_TABLES_CONNECTION_STRING")
self.access_key = os.getenv("TABLES_PRIMARY_STORAGE_ACCOUNT_KEY")
self.endpoint = os.getenv("TABLES_STORAGE_ENDPOINT_SUFFIX")
self.account_name = os.getenv("TABLES_STORAGE_ACCOUNT_NAME")
@@ -73,9 +71,10 @@ async def create_entity(self):
async def delete_entity(self):
from azure.data.tables.aio import TableClient
from azure.core.exceptions import ResourceNotFoundError, ResourceExistsError
- from azure.core import MatchConditions
+ from azure.core.credentials import AzureNamedKeyCredential
- table_client = TableClient(account_url=self.account_url, credential=self.access_key, table_name=self.table_name)
+ credential = AzureNamedKeyCredential(self.account_name, self.access_key)
+ table_client = TableClient(account_url=self.account_url, credential=credential, table_name=self.table_name)
# [START delete_entity]
async with table_client:
diff --git a/sdk/tables/azure-data-tables/samples/async_samples/sample_query_table_async.py b/sdk/tables/azure-data-tables/samples/async_samples/sample_query_table_async.py
index 5bee5fb21b69..a0ec962d5c63 100644
--- a/sdk/tables/azure-data-tables/samples/async_samples/sample_query_table_async.py
+++ b/sdk/tables/azure-data-tables/samples/async_samples/sample_query_table_async.py
@@ -30,7 +30,6 @@ class SampleTablesQuery(object):
def __init__(self):
load_dotenv(find_dotenv())
- # self.connection_string = os.getenv("AZURE_TABLES_CONNECTION_STRING")
self.access_key = os.getenv("TABLES_PRIMARY_STORAGE_ACCOUNT_KEY")
self.endpoint = os.getenv("TABLES_STORAGE_ENDPOINT_SUFFIX")
self.account_name = os.getenv("TABLES_STORAGE_ACCOUNT_NAME")
diff --git a/sdk/tables/azure-data-tables/samples/sample_authentication.py b/sdk/tables/azure-data-tables/samples/sample_authentication.py
index 97e7fe161b6e..21a245fffa43 100644
--- a/sdk/tables/azure-data-tables/samples/sample_authentication.py
+++ b/sdk/tables/azure-data-tables/samples/sample_authentication.py
@@ -36,7 +36,6 @@ class TableAuthSamples(object):
def __init__(self):
load_dotenv(find_dotenv())
- # self.connection_string = os.getenv("AZURE_TABLES_CONNECTION_STRING")
self.access_key = os.getenv("TABLES_PRIMARY_STORAGE_ACCOUNT_KEY")
self.endpoint = os.getenv("TABLES_STORAGE_ENDPOINT_SUFFIX")
self.account_name = os.getenv("TABLES_STORAGE_ACCOUNT_NAME")
@@ -60,7 +59,9 @@ def authentication_by_shared_key(self):
# Instantiate a TableServiceClient using a shared access key
# [START auth_from_shared_key]
from azure.data.tables import TableServiceClient
- with TableServiceClient(account_url=self.account_url, credential=self.access_key) as table_service:
+ from azure.core.credentials import AzureNamedKeyCredential
+ credential = AzureNamedKeyCredential(self.account_name, self.access_key)
+ with TableServiceClient(account_url=self.account_url, credential=credential) as table_service:
properties = table_service.get_service_properties()
print("Shared Key: {}".format(properties))
# [END auth_from_shared_key]
@@ -70,13 +71,14 @@ def authentication_by_shared_access_signature(self):
# [START auth_from_sas]
from azure.data.tables import TableServiceClient
+ from azure.core.credentials import AzureNamedKeyCredential
# Create a SAS token to use for authentication of a client
from azure.data.tables import generate_account_sas, ResourceTypes, AccountSasPermissions
print("Account name: {}".format(self.account_name))
+ credential = AzureNamedKeyCredential(self.account_name, self.access_key)
sas_token = generate_account_sas(
- self.account_name,
- self.access_key,
+ credential,
resource_types=ResourceTypes(service=True),
permission=AccountSasPermissions(read=True),
expiry=datetime.utcnow() + timedelta(hours=1)
diff --git a/sdk/tables/azure-data-tables/samples/sample_batching.py b/sdk/tables/azure-data-tables/samples/sample_batching.py
index 24fb23510e0b..da63ba086132 100644
--- a/sdk/tables/azure-data-tables/samples/sample_batching.py
+++ b/sdk/tables/azure-data-tables/samples/sample_batching.py
@@ -31,7 +31,6 @@ class CreateClients(object):
def __init__(self):
load_dotenv(find_dotenv())
- # self.connection_string = os.getenv("AZURE_TABLES_CONNECTION_STRING")
self.access_key = os.getenv("TABLES_PRIMARY_STORAGE_ACCOUNT_KEY")
self.endpoint = os.getenv("TABLES_STORAGE_ENDPOINT_SUFFIX")
self.account_name = os.getenv("TABLES_STORAGE_ACCOUNT_NAME")
diff --git a/sdk/tables/azure-data-tables/samples/sample_create_client.py b/sdk/tables/azure-data-tables/samples/sample_create_client.py
index a2560a2d2e3b..486360e53bce 100644
--- a/sdk/tables/azure-data-tables/samples/sample_create_client.py
+++ b/sdk/tables/azure-data-tables/samples/sample_create_client.py
@@ -26,11 +26,11 @@
from dotenv import find_dotenv, load_dotenv
import os
+
class CreateClients(object):
def __init__(self):
load_dotenv(find_dotenv())
- # self.connection_string = os.getenv("AZURE_TABLES_CONNECTION_STRING")
self.access_key = os.getenv("TABLES_PRIMARY_STORAGE_ACCOUNT_KEY")
self.endpoint = os.getenv("TABLES_STORAGE_ENDPOINT_SUFFIX")
self.account_name = os.getenv("TABLES_STORAGE_ACCOUNT_NAME")
@@ -54,7 +54,10 @@ def create_table_service_client(self):
# Instantiate a TableServiceClient using a shared access key
# [START create_table_service_client]
from azure.data.tables import TableServiceClient
- with TableServiceClient(account_url=self.account_url, credential=self.access_key) as table_service:
+ from azure.core.credentials import AzureNamedKeyCredential
+
+ credential = AzureNamedKeyCredential(self.account_name, self.access_key)
+ with TableServiceClient(account_url=self.account_url, credential=credential) as table_service:
properties = table_service.get_service_properties()
print("Properties: {}".format(properties))
# [END create_table_service_client]
diff --git a/sdk/tables/azure-data-tables/samples/sample_create_delete_table.py b/sdk/tables/azure-data-tables/samples/sample_create_delete_table.py
index 55d917e52887..474270d26beb 100644
--- a/sdk/tables/azure-data-tables/samples/sample_create_delete_table.py
+++ b/sdk/tables/azure-data-tables/samples/sample_create_delete_table.py
@@ -27,7 +27,6 @@ class CreateDeleteTable(object):
def __init__(self):
load_dotenv(find_dotenv())
- # self.connection_string = os.getenv("AZURE_TABLES_CONNECTION_STRING")
self.access_key = os.getenv("TABLES_PRIMARY_STORAGE_ACCOUNT_KEY")
self.endpoint = os.getenv("TABLES_STORAGE_ENDPOINT_SUFFIX")
self.account_name = os.getenv("TABLES_STORAGE_ACCOUNT_NAME")
diff --git a/sdk/tables/azure-data-tables/samples/sample_insert_delete_entities.py b/sdk/tables/azure-data-tables/samples/sample_insert_delete_entities.py
index e9f8bb833e04..03d7adb4d6b2 100644
--- a/sdk/tables/azure-data-tables/samples/sample_insert_delete_entities.py
+++ b/sdk/tables/azure-data-tables/samples/sample_insert_delete_entities.py
@@ -27,7 +27,6 @@ class InsertDeleteEntity(object):
def __init__(self):
load_dotenv(find_dotenv())
- # self.connection_string = os.getenv("AZURE_TABLES_CONNECTION_STRING")
self.access_key = os.getenv("TABLES_PRIMARY_STORAGE_ACCOUNT_KEY")
self.endpoint = os.getenv("TABLES_STORAGE_ENDPOINT_SUFFIX")
self.account_name = os.getenv("TABLES_STORAGE_ACCOUNT_NAME")
@@ -70,9 +69,10 @@ def create_entity(self):
def delete_entity(self):
from azure.data.tables import TableClient
from azure.core.exceptions import ResourceNotFoundError, ResourceExistsError
- from azure.core import MatchConditions
+ from azure.core.credentials import AzureNamedKeyCredential
- with TableClient(account_url=self.account_url, credential=self.access_key, table_name=self.table_name) as table_client:
+ credential = AzureNamedKeyCredential(self.account_name, self.access_key)
+ with TableClient(account_url=self.account_url, credential=credential, table_name=self.table_name) as table_client:
# Create entity to delete (to showcase etag)
try:
diff --git a/sdk/tables/azure-data-tables/setup.py b/sdk/tables/azure-data-tables/setup.py
index 2ce7123b3472..9c1043f5039a 100644
--- a/sdk/tables/azure-data-tables/setup.py
+++ b/sdk/tables/azure-data-tables/setup.py
@@ -79,7 +79,7 @@
'azure.data',
]),
install_requires=[
- "azure-core<2.0.0,>=1.13.0",
+ "azure-core<2.0.0,>=1.14.0",
"msrest>=0.6.19"
],
extras_require={
diff --git a/sdk/tables/azure-data-tables/tests/_shared/testcase.py b/sdk/tables/azure-data-tables/tests/_shared/testcase.py
index 518aead71473..19ab9d6279f1 100644
--- a/sdk/tables/azure-data-tables/tests/_shared/testcase.py
+++ b/sdk/tables/azure-data-tables/tests/_shared/testcase.py
@@ -14,7 +14,7 @@
import pytest
from devtools_testutils import AzureTestCase
-from azure.core.credentials import AccessToken
+from azure.core.credentials import AccessToken, AzureNamedKeyCredential
from azure.data.tables import generate_account_sas, AccountSasPermissions, ResourceTypes
LOGGING_FORMAT = '%(asctime)s %(name)-20s %(levelname)-5s %(message)s'
@@ -61,8 +61,7 @@ def generate_sas_token(self):
fake_key = 'a'*30 + 'b'*30
return '?' + generate_account_sas(
- account_name = 'test', # name of the storage account
- account_key = fake_key, # key for the storage account
+ credential = AzureNamedKeyCredential(name="fakename", key=fake_key),
resource_types = ResourceTypes(object=True),
permission = AccountSasPermissions(read=True,list=True),
start = datetime.now() - timedelta(hours = 24),
diff --git a/sdk/tables/azure-data-tables/tests/async_preparers.py b/sdk/tables/azure-data-tables/tests/async_preparers.py
new file mode 100644
index 000000000000..f198df6f88e5
--- /dev/null
+++ b/sdk/tables/azure-data-tables/tests/async_preparers.py
@@ -0,0 +1,47 @@
+import functools
+
+from azure.core.credentials import AzureNamedKeyCredential
+from preparers import CosmosPreparer, TablesPreparer, trim_kwargs_from_test_function
+
+def cosmos_decorator_async(func, **kwargs):
+
+ @CosmosPreparer()
+ def wrapper(*args, **kwargs):
+ key = kwargs.pop("tables_primary_cosmos_account_key")
+ name = kwargs.pop("tables_cosmos_account_name")
+ key = AzureNamedKeyCredential(key=key, name=name)
+
+ kwargs["tables_primary_cosmos_account_key"] = key
+ kwargs["tables_cosmos_account_name"] = name
+
+ trimmed_kwargs = {k:v for k, v in kwargs.items()}
+ trim_kwargs_from_test_function(func, trimmed_kwargs)
+
+ @functools.wraps(func)
+ async def wrapped(*args, **kwargs):
+ return await func(*args, **trimmed_kwargs)
+ return wrapped
+
+ return wrapper
+
+
+def tables_decorator_async(func, **kwargs):
+
+ @TablesPreparer()
+ def wrapper(*args, **kwargs):
+ key = kwargs.pop("tables_primary_storage_account_key")
+ name = kwargs.pop("tables_storage_account_name")
+ key = AzureNamedKeyCredential(key=key, name=name)
+
+ kwargs["tables_primary_storage_account_key"] = key
+ kwargs["tables_storage_account_name"] = name
+
+ trimmed_kwargs = {k:v for k, v in kwargs.items()}
+ trim_kwargs_from_test_function(func, trimmed_kwargs)
+
+ @functools.wraps(func)
+ async def wrapped(*args, **kwargs):
+ return await func(*args, **trimmed_kwargs)
+ return wrapped
+
+ return wrapper
diff --git a/sdk/tables/azure-data-tables/tests/preparers.py b/sdk/tables/azure-data-tables/tests/preparers.py
index ff6142f0c785..baef0629be10 100644
--- a/sdk/tables/azure-data-tables/tests/preparers.py
+++ b/sdk/tables/azure-data-tables/tests/preparers.py
@@ -1,4 +1,7 @@
import functools
+import inspect
+
+from azure.core.credentials import AzureNamedKeyCredential
from devtools_testutils import PowerShellPreparer
CosmosPreparer = functools.partial(
@@ -11,4 +14,57 @@
PowerShellPreparer, "tables",
tables_storage_account_name="fake_table_account",
tables_primary_storage_account_key="faketablesaccountkey"
-)
\ No newline at end of file
+)
+
+
+def trim_kwargs_from_test_function(fn, kwargs):
+ # the next function is the actual test function. the kwargs need to be trimmed so
+ # that parameters which are not required will not be passed to it.
+ if not getattr(fn, '__is_preparer', False):
+ try:
+ args, _, kw, _, _, _, _ = inspect.getfullargspec(fn)
+ except AttributeError:
+ args, _, kw, _ = inspect.getargspec(fn) # pylint: disable=deprecated-method
+ if kw is None:
+ args = set(args)
+ for key in [k for k in kwargs if k not in args]:
+ del kwargs[key]
+
+
+def tables_decorator(func, **kwargs):
+
+ @TablesPreparer()
+ def wrapper(*args, **kwargs):
+ key = kwargs.pop("tables_primary_storage_account_key")
+ name = kwargs.pop("tables_storage_account_name")
+ key = AzureNamedKeyCredential(key=key, name=name)
+
+ kwargs["tables_primary_storage_account_key"] = key
+ kwargs["tables_storage_account_name"] = name
+
+ trimmed_kwargs = {k:v for k, v in kwargs.items()}
+ trim_kwargs_from_test_function(func, trimmed_kwargs)
+
+ func(*args, **trimmed_kwargs)
+
+ return wrapper
+
+
+def cosmos_decorator(func, **kwargs):
+
+ @CosmosPreparer()
+ def wrapper(*args, **kwargs):
+ key = kwargs.pop("tables_primary_cosmos_account_key")
+ name = kwargs.pop("tables_cosmos_account_name")
+ key = AzureNamedKeyCredential(key=key, name=name)
+
+ kwargs["tables_primary_cosmos_account_key"] = key
+ kwargs["tables_cosmos_account_name"] = name
+
+ trimmed_kwargs = {k:v for k, v in kwargs.items()}
+ trim_kwargs_from_test_function(func, trimmed_kwargs)
+
+ func(*args, **trimmed_kwargs)
+
+ return wrapper
+
diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_batch.test_batch_sas_auth.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_batch.test_batch_sas_auth.yaml
index 8257d38f947f..e09b769887ba 100644
--- a/sdk/tables/azure-data-tables/tests/recordings/test_table_batch.test_batch_sas_auth.yaml
+++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_batch.test_batch_sas_auth.yaml
@@ -15,26 +15,27 @@ interactions:
DataServiceVersion:
- '3.0'
Date:
- - Fri, 05 Mar 2021 16:54:43 GMT
+ - Tue, 04 May 2021 14:50:11 GMT
User-Agent:
- - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0)
+ - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0)
x-ms-date:
- - Fri, 05 Mar 2021 16:54:43 GMT
+ - Tue, 04 May 2021 14:50:11 GMT
x-ms-version:
- '2019-02-02'
method: POST
uri: https://fake_table_account.table.core.windows.net/Tables
response:
body:
- string: '{"odata.error":{"code":"TableAlreadyExists","message":{"lang":"en-US","value":"The
- table specified already exists.\nRequestId:7fd90d5f-e002-003b-41e0-119f80000000\nTime:2021-03-05T16:54:43.1645315Z"}}}'
+ string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttabled4f0e8f"}'
headers:
cache-control:
- no-cache
content-type:
- application/json;odata=minimalmetadata;streaming=true;charset=utf-8
date:
- - Fri, 05 Mar 2021 16:54:42 GMT
+ - Tue, 04 May 2021 14:50:10 GMT
+ location:
+ - https://fake_table_account.table.core.windows.net/Tables('uttabled4f0e8f')
server:
- Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0
transfer-encoding:
@@ -44,161 +45,253 @@ interactions:
x-ms-version:
- '2019-02-02'
status:
- code: 409
- message: Conflict
+ code: 201
+ message: Created
- request:
- body: "--batch_8e6535d9-ecdb-4f9f-8547-dfe348188540\r\nContent-Type: multipart/mixed;\
- \ boundary=changeset_070b7ea2-9157-4ee4-8ce1-38b81ab0d4f6\r\n\r\n--changeset_070b7ea2-9157-4ee4-8ce1-38b81ab0d4f6\r\
+ body: "--batch_55293879-5ac0-43fa-bd37-76aaca1924dd\r\nContent-Type: multipart/mixed;\
+ \ boundary=changeset_d35eb054-0670-4875-a6d0-d99bc81ee1bd\r\n\r\n--changeset_d35eb054-0670-4875-a6d0-d99bc81ee1bd\r\
\nContent-Type: application/http\r\nContent-Transfer-Encoding: binary\r\nContent-ID:\
- \ 0\r\n\r\nPOST https://seankaneprim.table.core.windows.net/uttabled4f0e8f?st=2021-03-05T16%3A53%3A44Z&se=2021-03-05T17%3A54%3A44Z&sp=a&sv=2019-02-02&tn=uttabled4f0e8f&sig=TStgoQP%2FZDFaSw7JFX8lYcHHSbNXkWMaIejc8v7EGso%3D\
- \ HTTP/1.1\r\nx-ms-version: 2019-02-02\r\nDataServiceVersion: 3.0\r\nPrefer:\
- \ return-no-content\r\nContent-Type: application/json;odata=nometadata\r\nAccept:\
- \ application/json;odata=minimalmetadata\r\nContent-Length: 223\r\nx-ms-date:\
- \ Fri, 05 Mar 2021 16:54:44 GMT\r\nDate: Fri, 05 Mar 2021 16:54:44 GMT\r\nx-ms-client-request-id:\
- \ 7c64afbf-7dd3-11eb-ab63-002b67128e4c\r\n\r\n{\"PartitionKey\": \"batch_inserts\"\
- , \"PartitionKey@odata.type\": \"Edm.String\", \"test\": true, \"test2\": \"\
- value\", \"test2@odata.type\": \"Edm.String\", \"test3\": 3, \"test4\": 1234567890,\
- \ \"RowKey\": \"0\", \"RowKey@odata.type\": \"Edm.String\"}\r\n--changeset_070b7ea2-9157-4ee4-8ce1-38b81ab0d4f6\r\
+ \ 0\r\n\r\nPOST https://seankaneprim.table.core.windows.net/uttabled4f0e8f HTTP/1.1\r\
+ \nx-ms-version: 2019-02-02\r\nDataServiceVersion: 3.0\r\nPrefer: return-no-content\r\
+ \nContent-Type: application/json;odata=nometadata\r\nAccept: application/json;odata=minimalmetadata\r\
+ \nContent-Length: 223\r\nx-ms-date: Tue, 04 May 2021 14:50:12 GMT\r\nDate: Tue,\
+ \ 04 May 2021 14:50:12 GMT\r\n\r\n{\"PartitionKey\": \"batch_inserts\", \"PartitionKey@odata.type\"\
+ : \"Edm.String\", \"test\": true, \"test2\": \"value\", \"test2@odata.type\"\
+ : \"Edm.String\", \"test3\": 3, \"test4\": 1234567890, \"RowKey\": \"0\", \"\
+ RowKey@odata.type\": \"Edm.String\"}\r\n--changeset_d35eb054-0670-4875-a6d0-d99bc81ee1bd\r\
\nContent-Type: application/http\r\nContent-Transfer-Encoding: binary\r\nContent-ID:\
- \ 1\r\n\r\nPOST https://seankaneprim.table.core.windows.net/uttabled4f0e8f?st=2021-03-05T16%3A53%3A44Z&se=2021-03-05T17%3A54%3A44Z&sp=a&sv=2019-02-02&tn=uttabled4f0e8f&sig=TStgoQP%2FZDFaSw7JFX8lYcHHSbNXkWMaIejc8v7EGso%3D\
- \ HTTP/1.1\r\nx-ms-version: 2019-02-02\r\nDataServiceVersion: 3.0\r\nPrefer:\
- \ return-no-content\r\nContent-Type: application/json;odata=nometadata\r\nAccept:\
- \ application/json;odata=minimalmetadata\r\nContent-Length: 223\r\nx-ms-date:\
- \ Fri, 05 Mar 2021 16:54:44 GMT\r\nDate: Fri, 05 Mar 2021 16:54:44 GMT\r\nx-ms-client-request-id:\
- \ 7c64afc0-7dd3-11eb-8299-002b67128e4c\r\n\r\n{\"PartitionKey\": \"batch_inserts\"\
- , \"PartitionKey@odata.type\": \"Edm.String\", \"test\": true, \"test2\": \"\
- value\", \"test2@odata.type\": \"Edm.String\", \"test3\": 3, \"test4\": 1234567890,\
- \ \"RowKey\": \"1\", \"RowKey@odata.type\": \"Edm.String\"}\r\n--changeset_070b7ea2-9157-4ee4-8ce1-38b81ab0d4f6\r\
+ \ 1\r\n\r\nPOST https://seankaneprim.table.core.windows.net/uttabled4f0e8f HTTP/1.1\r\
+ \nx-ms-version: 2019-02-02\r\nDataServiceVersion: 3.0\r\nPrefer: return-no-content\r\
+ \nContent-Type: application/json;odata=nometadata\r\nAccept: application/json;odata=minimalmetadata\r\
+ \nContent-Length: 223\r\nx-ms-date: Tue, 04 May 2021 14:50:12 GMT\r\nDate: Tue,\
+ \ 04 May 2021 14:50:12 GMT\r\n\r\n{\"PartitionKey\": \"batch_inserts\", \"PartitionKey@odata.type\"\
+ : \"Edm.String\", \"test\": true, \"test2\": \"value\", \"test2@odata.type\"\
+ : \"Edm.String\", \"test3\": 3, \"test4\": 1234567890, \"RowKey\": \"1\", \"\
+ RowKey@odata.type\": \"Edm.String\"}\r\n--changeset_d35eb054-0670-4875-a6d0-d99bc81ee1bd\r\
\nContent-Type: application/http\r\nContent-Transfer-Encoding: binary\r\nContent-ID:\
- \ 2\r\n\r\nPOST https://seankaneprim.table.core.windows.net/uttabled4f0e8f?st=2021-03-05T16%3A53%3A44Z&se=2021-03-05T17%3A54%3A44Z&sp=a&sv=2019-02-02&tn=uttabled4f0e8f&sig=TStgoQP%2FZDFaSw7JFX8lYcHHSbNXkWMaIejc8v7EGso%3D\
- \ HTTP/1.1\r\nx-ms-version: 2019-02-02\r\nDataServiceVersion: 3.0\r\nPrefer:\
- \ return-no-content\r\nContent-Type: application/json;odata=nometadata\r\nAccept:\
- \ application/json;odata=minimalmetadata\r\nContent-Length: 223\r\nx-ms-date:\
- \ Fri, 05 Mar 2021 16:54:44 GMT\r\nDate: Fri, 05 Mar 2021 16:54:44 GMT\r\nx-ms-client-request-id:\
- \ 7c64d743-7dd3-11eb-a56b-002b67128e4c\r\n\r\n{\"PartitionKey\": \"batch_inserts\"\
- , \"PartitionKey@odata.type\": \"Edm.String\", \"test\": true, \"test2\": \"\
- value\", \"test2@odata.type\": \"Edm.String\", \"test3\": 3, \"test4\": 1234567890,\
- \ \"RowKey\": \"2\", \"RowKey@odata.type\": \"Edm.String\"}\r\n--changeset_070b7ea2-9157-4ee4-8ce1-38b81ab0d4f6\r\
+ \ 2\r\n\r\nPOST https://seankaneprim.table.core.windows.net/uttabled4f0e8f HTTP/1.1\r\
+ \nx-ms-version: 2019-02-02\r\nDataServiceVersion: 3.0\r\nPrefer: return-no-content\r\
+ \nContent-Type: application/json;odata=nometadata\r\nAccept: application/json;odata=minimalmetadata\r\
+ \nContent-Length: 223\r\nx-ms-date: Tue, 04 May 2021 14:50:12 GMT\r\nDate: Tue,\
+ \ 04 May 2021 14:50:12 GMT\r\n\r\n{\"PartitionKey\": \"batch_inserts\", \"PartitionKey@odata.type\"\
+ : \"Edm.String\", \"test\": true, \"test2\": \"value\", \"test2@odata.type\"\
+ : \"Edm.String\", \"test3\": 3, \"test4\": 1234567890, \"RowKey\": \"2\", \"\
+ RowKey@odata.type\": \"Edm.String\"}\r\n--changeset_d35eb054-0670-4875-a6d0-d99bc81ee1bd\r\
\nContent-Type: application/http\r\nContent-Transfer-Encoding: binary\r\nContent-ID:\
- \ 3\r\n\r\nPOST https://seankaneprim.table.core.windows.net/uttabled4f0e8f?st=2021-03-05T16%3A53%3A44Z&se=2021-03-05T17%3A54%3A44Z&sp=a&sv=2019-02-02&tn=uttabled4f0e8f&sig=TStgoQP%2FZDFaSw7JFX8lYcHHSbNXkWMaIejc8v7EGso%3D\
- \ HTTP/1.1\r\nx-ms-version: 2019-02-02\r\nDataServiceVersion: 3.0\r\nPrefer:\
- \ return-no-content\r\nContent-Type: application/json;odata=nometadata\r\nAccept:\
- \ application/json;odata=minimalmetadata\r\nContent-Length: 223\r\nx-ms-date:\
- \ Fri, 05 Mar 2021 16:54:44 GMT\r\nDate: Fri, 05 Mar 2021 16:54:44 GMT\r\nx-ms-client-request-id:\
- \ 7c65083f-7dd3-11eb-88e4-002b67128e4c\r\n\r\n{\"PartitionKey\": \"batch_inserts\"\
- , \"PartitionKey@odata.type\": \"Edm.String\", \"test\": true, \"test2\": \"\
- value\", \"test2@odata.type\": \"Edm.String\", \"test3\": 3, \"test4\": 1234567890,\
- \ \"RowKey\": \"3\", \"RowKey@odata.type\": \"Edm.String\"}\r\n--changeset_070b7ea2-9157-4ee4-8ce1-38b81ab0d4f6\r\
+ \ 3\r\n\r\nPOST https://seankaneprim.table.core.windows.net/uttabled4f0e8f HTTP/1.1\r\
+ \nx-ms-version: 2019-02-02\r\nDataServiceVersion: 3.0\r\nPrefer: return-no-content\r\
+ \nContent-Type: application/json;odata=nometadata\r\nAccept: application/json;odata=minimalmetadata\r\
+ \nContent-Length: 223\r\nx-ms-date: Tue, 04 May 2021 14:50:12 GMT\r\nDate: Tue,\
+ \ 04 May 2021 14:50:12 GMT\r\n\r\n{\"PartitionKey\": \"batch_inserts\", \"PartitionKey@odata.type\"\
+ : \"Edm.String\", \"test\": true, \"test2\": \"value\", \"test2@odata.type\"\
+ : \"Edm.String\", \"test3\": 3, \"test4\": 1234567890, \"RowKey\": \"3\", \"\
+ RowKey@odata.type\": \"Edm.String\"}\r\n--changeset_d35eb054-0670-4875-a6d0-d99bc81ee1bd\r\
\nContent-Type: application/http\r\nContent-Transfer-Encoding: binary\r\nContent-ID:\
- \ 4\r\n\r\nPOST https://seankaneprim.table.core.windows.net/uttabled4f0e8f?st=2021-03-05T16%3A53%3A44Z&se=2021-03-05T17%3A54%3A44Z&sp=a&sv=2019-02-02&tn=uttabled4f0e8f&sig=TStgoQP%2FZDFaSw7JFX8lYcHHSbNXkWMaIejc8v7EGso%3D\
- \ HTTP/1.1\r\nx-ms-version: 2019-02-02\r\nDataServiceVersion: 3.0\r\nPrefer:\
- \ return-no-content\r\nContent-Type: application/json;odata=nometadata\r\nAccept:\
- \ application/json;odata=minimalmetadata\r\nContent-Length: 223\r\nx-ms-date:\
- \ Fri, 05 Mar 2021 16:54:44 GMT\r\nDate: Fri, 05 Mar 2021 16:54:44 GMT\r\nx-ms-client-request-id:\
- \ 7c650840-7dd3-11eb-8f93-002b67128e4c\r\n\r\n{\"PartitionKey\": \"batch_inserts\"\
- , \"PartitionKey@odata.type\": \"Edm.String\", \"test\": true, \"test2\": \"\
- value\", \"test2@odata.type\": \"Edm.String\", \"test3\": 3, \"test4\": 1234567890,\
- \ \"RowKey\": \"4\", \"RowKey@odata.type\": \"Edm.String\"}\r\n--changeset_070b7ea2-9157-4ee4-8ce1-38b81ab0d4f6\r\
+ \ 4\r\n\r\nPOST https://seankaneprim.table.core.windows.net/uttabled4f0e8f HTTP/1.1\r\
+ \nx-ms-version: 2019-02-02\r\nDataServiceVersion: 3.0\r\nPrefer: return-no-content\r\
+ \nContent-Type: application/json;odata=nometadata\r\nAccept: application/json;odata=minimalmetadata\r\
+ \nContent-Length: 223\r\nx-ms-date: Tue, 04 May 2021 14:50:12 GMT\r\nDate: Tue,\
+ \ 04 May 2021 14:50:12 GMT\r\n\r\n{\"PartitionKey\": \"batch_inserts\", \"PartitionKey@odata.type\"\
+ : \"Edm.String\", \"test\": true, \"test2\": \"value\", \"test2@odata.type\"\
+ : \"Edm.String\", \"test3\": 3, \"test4\": 1234567890, \"RowKey\": \"4\", \"\
+ RowKey@odata.type\": \"Edm.String\"}\r\n--changeset_d35eb054-0670-4875-a6d0-d99bc81ee1bd\r\
\nContent-Type: application/http\r\nContent-Transfer-Encoding: binary\r\nContent-ID:\
- \ 5\r\n\r\nPOST https://seankaneprim.table.core.windows.net/uttabled4f0e8f?st=2021-03-05T16%3A53%3A44Z&se=2021-03-05T17%3A54%3A44Z&sp=a&sv=2019-02-02&tn=uttabled4f0e8f&sig=TStgoQP%2FZDFaSw7JFX8lYcHHSbNXkWMaIejc8v7EGso%3D\
- \ HTTP/1.1\r\nx-ms-version: 2019-02-02\r\nDataServiceVersion: 3.0\r\nPrefer:\
- \ return-no-content\r\nContent-Type: application/json;odata=nometadata\r\nAccept:\
- \ application/json;odata=minimalmetadata\r\nContent-Length: 223\r\nx-ms-date:\
- \ Fri, 05 Mar 2021 16:54:44 GMT\r\nDate: Fri, 05 Mar 2021 16:54:44 GMT\r\nx-ms-client-request-id:\
- \ 7c650841-7dd3-11eb-a3d0-002b67128e4c\r\n\r\n{\"PartitionKey\": \"batch_inserts\"\
- , \"PartitionKey@odata.type\": \"Edm.String\", \"test\": true, \"test2\": \"\
- value\", \"test2@odata.type\": \"Edm.String\", \"test3\": 3, \"test4\": 1234567890,\
- \ \"RowKey\": \"5\", \"RowKey@odata.type\": \"Edm.String\"}\r\n--changeset_070b7ea2-9157-4ee4-8ce1-38b81ab0d4f6\r\
+ \ 5\r\n\r\nPOST https://seankaneprim.table.core.windows.net/uttabled4f0e8f HTTP/1.1\r\
+ \nx-ms-version: 2019-02-02\r\nDataServiceVersion: 3.0\r\nPrefer: return-no-content\r\
+ \nContent-Type: application/json;odata=nometadata\r\nAccept: application/json;odata=minimalmetadata\r\
+ \nContent-Length: 223\r\nx-ms-date: Tue, 04 May 2021 14:50:12 GMT\r\nDate: Tue,\
+ \ 04 May 2021 14:50:12 GMT\r\n\r\n{\"PartitionKey\": \"batch_inserts\", \"PartitionKey@odata.type\"\
+ : \"Edm.String\", \"test\": true, \"test2\": \"value\", \"test2@odata.type\"\
+ : \"Edm.String\", \"test3\": 3, \"test4\": 1234567890, \"RowKey\": \"5\", \"\
+ RowKey@odata.type\": \"Edm.String\"}\r\n--changeset_d35eb054-0670-4875-a6d0-d99bc81ee1bd\r\
\nContent-Type: application/http\r\nContent-Transfer-Encoding: binary\r\nContent-ID:\
- \ 6\r\n\r\nPOST https://seankaneprim.table.core.windows.net/uttabled4f0e8f?st=2021-03-05T16%3A53%3A44Z&se=2021-03-05T17%3A54%3A44Z&sp=a&sv=2019-02-02&tn=uttabled4f0e8f&sig=TStgoQP%2FZDFaSw7JFX8lYcHHSbNXkWMaIejc8v7EGso%3D\
- \ HTTP/1.1\r\nx-ms-version: 2019-02-02\r\nDataServiceVersion: 3.0\r\nPrefer:\
- \ return-no-content\r\nContent-Type: application/json;odata=nometadata\r\nAccept:\
- \ application/json;odata=minimalmetadata\r\nContent-Length: 223\r\nx-ms-date:\
- \ Fri, 05 Mar 2021 16:54:44 GMT\r\nDate: Fri, 05 Mar 2021 16:54:44 GMT\r\nx-ms-client-request-id:\
- \ 7c653e76-7dd3-11eb-9358-002b67128e4c\r\n\r\n{\"PartitionKey\": \"batch_inserts\"\
- , \"PartitionKey@odata.type\": \"Edm.String\", \"test\": true, \"test2\": \"\
- value\", \"test2@odata.type\": \"Edm.String\", \"test3\": 3, \"test4\": 1234567890,\
- \ \"RowKey\": \"6\", \"RowKey@odata.type\": \"Edm.String\"}\r\n--changeset_070b7ea2-9157-4ee4-8ce1-38b81ab0d4f6\r\
+ \ 6\r\n\r\nPOST https://seankaneprim.table.core.windows.net/uttabled4f0e8f HTTP/1.1\r\
+ \nx-ms-version: 2019-02-02\r\nDataServiceVersion: 3.0\r\nPrefer: return-no-content\r\
+ \nContent-Type: application/json;odata=nometadata\r\nAccept: application/json;odata=minimalmetadata\r\
+ \nContent-Length: 223\r\nx-ms-date: Tue, 04 May 2021 14:50:12 GMT\r\nDate: Tue,\
+ \ 04 May 2021 14:50:12 GMT\r\n\r\n{\"PartitionKey\": \"batch_inserts\", \"PartitionKey@odata.type\"\
+ : \"Edm.String\", \"test\": true, \"test2\": \"value\", \"test2@odata.type\"\
+ : \"Edm.String\", \"test3\": 3, \"test4\": 1234567890, \"RowKey\": \"6\", \"\
+ RowKey@odata.type\": \"Edm.String\"}\r\n--changeset_d35eb054-0670-4875-a6d0-d99bc81ee1bd\r\
\nContent-Type: application/http\r\nContent-Transfer-Encoding: binary\r\nContent-ID:\
- \ 7\r\n\r\nPOST https://seankaneprim.table.core.windows.net/uttabled4f0e8f?st=2021-03-05T16%3A53%3A44Z&se=2021-03-05T17%3A54%3A44Z&sp=a&sv=2019-02-02&tn=uttabled4f0e8f&sig=TStgoQP%2FZDFaSw7JFX8lYcHHSbNXkWMaIejc8v7EGso%3D\
- \ HTTP/1.1\r\nx-ms-version: 2019-02-02\r\nDataServiceVersion: 3.0\r\nPrefer:\
- \ return-no-content\r\nContent-Type: application/json;odata=nometadata\r\nAccept:\
- \ application/json;odata=minimalmetadata\r\nContent-Length: 223\r\nx-ms-date:\
- \ Fri, 05 Mar 2021 16:54:44 GMT\r\nDate: Fri, 05 Mar 2021 16:54:44 GMT\r\nx-ms-client-request-id:\
- \ 7c653e77-7dd3-11eb-a991-002b67128e4c\r\n\r\n{\"PartitionKey\": \"batch_inserts\"\
- , \"PartitionKey@odata.type\": \"Edm.String\", \"test\": true, \"test2\": \"\
- value\", \"test2@odata.type\": \"Edm.String\", \"test3\": 3, \"test4\": 1234567890,\
- \ \"RowKey\": \"7\", \"RowKey@odata.type\": \"Edm.String\"}\r\n--changeset_070b7ea2-9157-4ee4-8ce1-38b81ab0d4f6\r\
+ \ 7\r\n\r\nPOST https://seankaneprim.table.core.windows.net/uttabled4f0e8f HTTP/1.1\r\
+ \nx-ms-version: 2019-02-02\r\nDataServiceVersion: 3.0\r\nPrefer: return-no-content\r\
+ \nContent-Type: application/json;odata=nometadata\r\nAccept: application/json;odata=minimalmetadata\r\
+ \nContent-Length: 223\r\nx-ms-date: Tue, 04 May 2021 14:50:12 GMT\r\nDate: Tue,\
+ \ 04 May 2021 14:50:12 GMT\r\n\r\n{\"PartitionKey\": \"batch_inserts\", \"PartitionKey@odata.type\"\
+ : \"Edm.String\", \"test\": true, \"test2\": \"value\", \"test2@odata.type\"\
+ : \"Edm.String\", \"test3\": 3, \"test4\": 1234567890, \"RowKey\": \"7\", \"\
+ RowKey@odata.type\": \"Edm.String\"}\r\n--changeset_d35eb054-0670-4875-a6d0-d99bc81ee1bd\r\
\nContent-Type: application/http\r\nContent-Transfer-Encoding: binary\r\nContent-ID:\
- \ 8\r\n\r\nPOST https://seankaneprim.table.core.windows.net/uttabled4f0e8f?st=2021-03-05T16%3A53%3A44Z&se=2021-03-05T17%3A54%3A44Z&sp=a&sv=2019-02-02&tn=uttabled4f0e8f&sig=TStgoQP%2FZDFaSw7JFX8lYcHHSbNXkWMaIejc8v7EGso%3D\
- \ HTTP/1.1\r\nx-ms-version: 2019-02-02\r\nDataServiceVersion: 3.0\r\nPrefer:\
- \ return-no-content\r\nContent-Type: application/json;odata=nometadata\r\nAccept:\
- \ application/json;odata=minimalmetadata\r\nContent-Length: 223\r\nx-ms-date:\
- \ Fri, 05 Mar 2021 16:54:44 GMT\r\nDate: Fri, 05 Mar 2021 16:54:44 GMT\r\nx-ms-client-request-id:\
- \ 7c653e78-7dd3-11eb-9906-002b67128e4c\r\n\r\n{\"PartitionKey\": \"batch_inserts\"\
- , \"PartitionKey@odata.type\": \"Edm.String\", \"test\": true, \"test2\": \"\
- value\", \"test2@odata.type\": \"Edm.String\", \"test3\": 3, \"test4\": 1234567890,\
- \ \"RowKey\": \"8\", \"RowKey@odata.type\": \"Edm.String\"}\r\n--changeset_070b7ea2-9157-4ee4-8ce1-38b81ab0d4f6\r\
+ \ 8\r\n\r\nPOST https://seankaneprim.table.core.windows.net/uttabled4f0e8f HTTP/1.1\r\
+ \nx-ms-version: 2019-02-02\r\nDataServiceVersion: 3.0\r\nPrefer: return-no-content\r\
+ \nContent-Type: application/json;odata=nometadata\r\nAccept: application/json;odata=minimalmetadata\r\
+ \nContent-Length: 223\r\nx-ms-date: Tue, 04 May 2021 14:50:12 GMT\r\nDate: Tue,\
+ \ 04 May 2021 14:50:12 GMT\r\n\r\n{\"PartitionKey\": \"batch_inserts\", \"PartitionKey@odata.type\"\
+ : \"Edm.String\", \"test\": true, \"test2\": \"value\", \"test2@odata.type\"\
+ : \"Edm.String\", \"test3\": 3, \"test4\": 1234567890, \"RowKey\": \"8\", \"\
+ RowKey@odata.type\": \"Edm.String\"}\r\n--changeset_d35eb054-0670-4875-a6d0-d99bc81ee1bd\r\
\nContent-Type: application/http\r\nContent-Transfer-Encoding: binary\r\nContent-ID:\
- \ 9\r\n\r\nPOST https://seankaneprim.table.core.windows.net/uttabled4f0e8f?st=2021-03-05T16%3A53%3A44Z&se=2021-03-05T17%3A54%3A44Z&sp=a&sv=2019-02-02&tn=uttabled4f0e8f&sig=TStgoQP%2FZDFaSw7JFX8lYcHHSbNXkWMaIejc8v7EGso%3D\
- \ HTTP/1.1\r\nx-ms-version: 2019-02-02\r\nDataServiceVersion: 3.0\r\nPrefer:\
- \ return-no-content\r\nContent-Type: application/json;odata=nometadata\r\nAccept:\
- \ application/json;odata=minimalmetadata\r\nContent-Length: 223\r\nx-ms-date:\
- \ Fri, 05 Mar 2021 16:54:44 GMT\r\nDate: Fri, 05 Mar 2021 16:54:44 GMT\r\nx-ms-client-request-id:\
- \ 7c653e79-7dd3-11eb-81dd-002b67128e4c\r\n\r\n{\"PartitionKey\": \"batch_inserts\"\
- , \"PartitionKey@odata.type\": \"Edm.String\", \"test\": true, \"test2\": \"\
- value\", \"test2@odata.type\": \"Edm.String\", \"test3\": 3, \"test4\": 1234567890,\
- \ \"RowKey\": \"9\", \"RowKey@odata.type\": \"Edm.String\"}\r\n--changeset_070b7ea2-9157-4ee4-8ce1-38b81ab0d4f6--\r\
- \n\r\n--batch_8e6535d9-ecdb-4f9f-8547-dfe348188540--\r\n"
+ \ 9\r\n\r\nPOST https://seankaneprim.table.core.windows.net/uttabled4f0e8f HTTP/1.1\r\
+ \nx-ms-version: 2019-02-02\r\nDataServiceVersion: 3.0\r\nPrefer: return-no-content\r\
+ \nContent-Type: application/json;odata=nometadata\r\nAccept: application/json;odata=minimalmetadata\r\
+ \nContent-Length: 223\r\nx-ms-date: Tue, 04 May 2021 14:50:12 GMT\r\nDate: Tue,\
+ \ 04 May 2021 14:50:12 GMT\r\n\r\n{\"PartitionKey\": \"batch_inserts\", \"PartitionKey@odata.type\"\
+ : \"Edm.String\", \"test\": true, \"test2\": \"value\", \"test2@odata.type\"\
+ : \"Edm.String\", \"test3\": 3, \"test4\": 1234567890, \"RowKey\": \"9\", \"\
+ RowKey@odata.type\": \"Edm.String\"}\r\n--changeset_d35eb054-0670-4875-a6d0-d99bc81ee1bd--\r\
+ \n\r\n--batch_55293879-5ac0-43fa-bd37-76aaca1924dd--\r\n"
headers:
Accept:
- - '*/*'
+ - application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- - '9418'
+ - '7338'
Content-Type:
- - multipart/mixed; boundary=batch_8e6535d9-ecdb-4f9f-8547-dfe348188540
+ - multipart/mixed; boundary=batch_55293879-5ac0-43fa-bd37-76aaca1924dd
DataServiceVersion:
- '3.0'
Date:
- - Fri, 05 Mar 2021 16:54:44 GMT
+ - Tue, 04 May 2021 14:50:12 GMT
MaxDataServiceVersion:
- 3.0;NetFx
User-Agent:
- - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0)
+ - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0)
x-ms-date:
- - Fri, 05 Mar 2021 16:54:44 GMT
+ - Tue, 04 May 2021 14:50:12 GMT
x-ms-version:
- '2019-02-02'
method: POST
- uri: https://fake_table_account.table.core.windows.net/$batch
+ uri: https://fake_table_account.table.core.windows.net/$batch?st=2021-05-04T14%3A49%3A12Z&se=2021-05-04T15%3A50%3A12Z&sp=raud&sv=2019-02-02&tn=uttabled4f0e8f&sig=pCtZ%2Bi0nYyGYgmjbsh7wtWU9ARxUw8pqcTCoW4y2Ps4%3D
response:
body:
- string: 'ResourceNotFoundThe specified resource does not exist.
-
- RequestId:b6ba23cc-3002-005a-7ce0-11bcc3000000
-
- Time:2021-03-05T16:54:44.0091854Z'
+ string: "--batchresponse_68119672-5138-44ac-b47f-8a768b9c4dd1\r\nContent-Type:\
+ \ multipart/mixed; boundary=changesetresponse_3e551cd8-6f28-443b-b103-79390a25d94a\r\
+ \n\r\n--changesetresponse_3e551cd8-6f28-443b-b103-79390a25d94a\r\nContent-Type:\
+ \ application/http\r\nContent-Transfer-Encoding: binary\r\n\r\nHTTP/1.1 204\
+ \ No Content\r\nX-Content-Type-Options: nosniff\r\nCache-Control: no-cache\r\
+ \nPreference-Applied: return-no-content\r\nDataServiceVersion: 3.0;\r\nLocation:\
+ \ https://seankaneprim.table.core.windows.net/uttabled4f0e8f(PartitionKey='batch_inserts',RowKey='0')\r\
+ \nDataServiceId: https://seankaneprim.table.core.windows.net/uttabled4f0e8f(PartitionKey='batch_inserts',RowKey='0')\r\
+ \nETag: W/\"datetime'2021-05-04T14%3A50%3A10.7782844Z'\"\r\n\r\n\r\n--changesetresponse_3e551cd8-6f28-443b-b103-79390a25d94a\r\
+ \nContent-Type: application/http\r\nContent-Transfer-Encoding: binary\r\n\r\
+ \nHTTP/1.1 204 No Content\r\nX-Content-Type-Options: nosniff\r\nCache-Control:\
+ \ no-cache\r\nPreference-Applied: return-no-content\r\nDataServiceVersion:\
+ \ 3.0;\r\nLocation: https://seankaneprim.table.core.windows.net/uttabled4f0e8f(PartitionKey='batch_inserts',RowKey='1')\r\
+ \nDataServiceId: https://seankaneprim.table.core.windows.net/uttabled4f0e8f(PartitionKey='batch_inserts',RowKey='1')\r\
+ \nETag: W/\"datetime'2021-05-04T14%3A50%3A10.7782844Z'\"\r\n\r\n\r\n--changesetresponse_3e551cd8-6f28-443b-b103-79390a25d94a\r\
+ \nContent-Type: application/http\r\nContent-Transfer-Encoding: binary\r\n\r\
+ \nHTTP/1.1 204 No Content\r\nX-Content-Type-Options: nosniff\r\nCache-Control:\
+ \ no-cache\r\nPreference-Applied: return-no-content\r\nDataServiceVersion:\
+ \ 3.0;\r\nLocation: https://seankaneprim.table.core.windows.net/uttabled4f0e8f(PartitionKey='batch_inserts',RowKey='2')\r\
+ \nDataServiceId: https://seankaneprim.table.core.windows.net/uttabled4f0e8f(PartitionKey='batch_inserts',RowKey='2')\r\
+ \nETag: W/\"datetime'2021-05-04T14%3A50%3A10.7782844Z'\"\r\n\r\n\r\n--changesetresponse_3e551cd8-6f28-443b-b103-79390a25d94a\r\
+ \nContent-Type: application/http\r\nContent-Transfer-Encoding: binary\r\n\r\
+ \nHTTP/1.1 204 No Content\r\nX-Content-Type-Options: nosniff\r\nCache-Control:\
+ \ no-cache\r\nPreference-Applied: return-no-content\r\nDataServiceVersion:\
+ \ 3.0;\r\nLocation: https://seankaneprim.table.core.windows.net/uttabled4f0e8f(PartitionKey='batch_inserts',RowKey='3')\r\
+ \nDataServiceId: https://seankaneprim.table.core.windows.net/uttabled4f0e8f(PartitionKey='batch_inserts',RowKey='3')\r\
+ \nETag: W/\"datetime'2021-05-04T14%3A50%3A10.7782844Z'\"\r\n\r\n\r\n--changesetresponse_3e551cd8-6f28-443b-b103-79390a25d94a\r\
+ \nContent-Type: application/http\r\nContent-Transfer-Encoding: binary\r\n\r\
+ \nHTTP/1.1 204 No Content\r\nX-Content-Type-Options: nosniff\r\nCache-Control:\
+ \ no-cache\r\nPreference-Applied: return-no-content\r\nDataServiceVersion:\
+ \ 3.0;\r\nLocation: https://seankaneprim.table.core.windows.net/uttabled4f0e8f(PartitionKey='batch_inserts',RowKey='4')\r\
+ \nDataServiceId: https://seankaneprim.table.core.windows.net/uttabled4f0e8f(PartitionKey='batch_inserts',RowKey='4')\r\
+ \nETag: W/\"datetime'2021-05-04T14%3A50%3A10.7782844Z'\"\r\n\r\n\r\n--changesetresponse_3e551cd8-6f28-443b-b103-79390a25d94a\r\
+ \nContent-Type: application/http\r\nContent-Transfer-Encoding: binary\r\n\r\
+ \nHTTP/1.1 204 No Content\r\nX-Content-Type-Options: nosniff\r\nCache-Control:\
+ \ no-cache\r\nPreference-Applied: return-no-content\r\nDataServiceVersion:\
+ \ 3.0;\r\nLocation: https://seankaneprim.table.core.windows.net/uttabled4f0e8f(PartitionKey='batch_inserts',RowKey='5')\r\
+ \nDataServiceId: https://seankaneprim.table.core.windows.net/uttabled4f0e8f(PartitionKey='batch_inserts',RowKey='5')\r\
+ \nETag: W/\"datetime'2021-05-04T14%3A50%3A10.7782844Z'\"\r\n\r\n\r\n--changesetresponse_3e551cd8-6f28-443b-b103-79390a25d94a\r\
+ \nContent-Type: application/http\r\nContent-Transfer-Encoding: binary\r\n\r\
+ \nHTTP/1.1 204 No Content\r\nX-Content-Type-Options: nosniff\r\nCache-Control:\
+ \ no-cache\r\nPreference-Applied: return-no-content\r\nDataServiceVersion:\
+ \ 3.0;\r\nLocation: https://seankaneprim.table.core.windows.net/uttabled4f0e8f(PartitionKey='batch_inserts',RowKey='6')\r\
+ \nDataServiceId: https://seankaneprim.table.core.windows.net/uttabled4f0e8f(PartitionKey='batch_inserts',RowKey='6')\r\
+ \nETag: W/\"datetime'2021-05-04T14%3A50%3A10.7782844Z'\"\r\n\r\n\r\n--changesetresponse_3e551cd8-6f28-443b-b103-79390a25d94a\r\
+ \nContent-Type: application/http\r\nContent-Transfer-Encoding: binary\r\n\r\
+ \nHTTP/1.1 204 No Content\r\nX-Content-Type-Options: nosniff\r\nCache-Control:\
+ \ no-cache\r\nPreference-Applied: return-no-content\r\nDataServiceVersion:\
+ \ 3.0;\r\nLocation: https://seankaneprim.table.core.windows.net/uttabled4f0e8f(PartitionKey='batch_inserts',RowKey='7')\r\
+ \nDataServiceId: https://seankaneprim.table.core.windows.net/uttabled4f0e8f(PartitionKey='batch_inserts',RowKey='7')\r\
+ \nETag: W/\"datetime'2021-05-04T14%3A50%3A10.7782844Z'\"\r\n\r\n\r\n--changesetresponse_3e551cd8-6f28-443b-b103-79390a25d94a\r\
+ \nContent-Type: application/http\r\nContent-Transfer-Encoding: binary\r\n\r\
+ \nHTTP/1.1 204 No Content\r\nX-Content-Type-Options: nosniff\r\nCache-Control:\
+ \ no-cache\r\nPreference-Applied: return-no-content\r\nDataServiceVersion:\
+ \ 3.0;\r\nLocation: https://seankaneprim.table.core.windows.net/uttabled4f0e8f(PartitionKey='batch_inserts',RowKey='8')\r\
+ \nDataServiceId: https://seankaneprim.table.core.windows.net/uttabled4f0e8f(PartitionKey='batch_inserts',RowKey='8')\r\
+ \nETag: W/\"datetime'2021-05-04T14%3A50%3A10.7782844Z'\"\r\n\r\n\r\n--changesetresponse_3e551cd8-6f28-443b-b103-79390a25d94a\r\
+ \nContent-Type: application/http\r\nContent-Transfer-Encoding: binary\r\n\r\
+ \nHTTP/1.1 204 No Content\r\nX-Content-Type-Options: nosniff\r\nCache-Control:\
+ \ no-cache\r\nPreference-Applied: return-no-content\r\nDataServiceVersion:\
+ \ 3.0;\r\nLocation: https://seankaneprim.table.core.windows.net/uttabled4f0e8f(PartitionKey='batch_inserts',RowKey='9')\r\
+ \nDataServiceId: https://seankaneprim.table.core.windows.net/uttabled4f0e8f(PartitionKey='batch_inserts',RowKey='9')\r\
+ \nETag: W/\"datetime'2021-05-04T14%3A50%3A10.7782844Z'\"\r\n\r\n\r\n--changesetresponse_3e551cd8-6f28-443b-b103-79390a25d94a--\r\
+ \n--batchresponse_68119672-5138-44ac-b47f-8a768b9c4dd1--\r\n"
headers:
- content-length:
- - '322'
+ cache-control:
+ - no-cache
content-type:
- - application/xml
+ - multipart/mixed; boundary=batchresponse_68119672-5138-44ac-b47f-8a768b9c4dd1
date:
- - Fri, 05 Mar 2021 16:54:43 GMT
+ - Tue, 04 May 2021 14:50:10 GMT
server:
- Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0
- x-ms-error-code:
- - ResourceNotFound
+ transfer-encoding:
+ - chunked
+ x-content-type-options:
+ - nosniff
+ x-ms-version:
+ - '2019-02-02'
+ status:
+ code: 202
+ message: Accepted
+- request:
+ body: null
+ headers:
+ Accept:
+ - application/json;odata=minimalmetadata
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ DataServiceVersion:
+ - '3.0'
+ Date:
+ - Tue, 04 May 2021 14:50:13 GMT
+ User-Agent:
+ - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0)
+ x-ms-date:
+ - Tue, 04 May 2021 14:50:13 GMT
+ x-ms-version:
+ - '2019-02-02'
+ method: GET
+ uri: https://fake_table_account.table.core.windows.net/uttabled4f0e8f()?st=2021-05-04T14%3A49%3A12Z&se=2021-05-04T15%3A50%3A12Z&sp=raud&sv=2019-02-02&tn=uttabled4f0e8f&sig=pCtZ%2Bi0nYyGYgmjbsh7wtWU9ARxUw8pqcTCoW4y2Ps4%3D
+ response:
+ body:
+ string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttabled4f0e8f","value":[{"odata.etag":"W/\"datetime''2021-05-04T14%3A50%3A10.7782844Z''\"","PartitionKey":"batch_inserts","RowKey":"0","Timestamp":"2021-05-04T14:50:10.7782844Z","test":true,"test2":"value","test3":3,"test4":1234567890},{"odata.etag":"W/\"datetime''2021-05-04T14%3A50%3A10.7782844Z''\"","PartitionKey":"batch_inserts","RowKey":"1","Timestamp":"2021-05-04T14:50:10.7782844Z","test":true,"test2":"value","test3":3,"test4":1234567890},{"odata.etag":"W/\"datetime''2021-05-04T14%3A50%3A10.7782844Z''\"","PartitionKey":"batch_inserts","RowKey":"2","Timestamp":"2021-05-04T14:50:10.7782844Z","test":true,"test2":"value","test3":3,"test4":1234567890},{"odata.etag":"W/\"datetime''2021-05-04T14%3A50%3A10.7782844Z''\"","PartitionKey":"batch_inserts","RowKey":"3","Timestamp":"2021-05-04T14:50:10.7782844Z","test":true,"test2":"value","test3":3,"test4":1234567890},{"odata.etag":"W/\"datetime''2021-05-04T14%3A50%3A10.7782844Z''\"","PartitionKey":"batch_inserts","RowKey":"4","Timestamp":"2021-05-04T14:50:10.7782844Z","test":true,"test2":"value","test3":3,"test4":1234567890},{"odata.etag":"W/\"datetime''2021-05-04T14%3A50%3A10.7782844Z''\"","PartitionKey":"batch_inserts","RowKey":"5","Timestamp":"2021-05-04T14:50:10.7782844Z","test":true,"test2":"value","test3":3,"test4":1234567890},{"odata.etag":"W/\"datetime''2021-05-04T14%3A50%3A10.7782844Z''\"","PartitionKey":"batch_inserts","RowKey":"6","Timestamp":"2021-05-04T14:50:10.7782844Z","test":true,"test2":"value","test3":3,"test4":1234567890},{"odata.etag":"W/\"datetime''2021-05-04T14%3A50%3A10.7782844Z''\"","PartitionKey":"batch_inserts","RowKey":"7","Timestamp":"2021-05-04T14:50:10.7782844Z","test":true,"test2":"value","test3":3,"test4":1234567890},{"odata.etag":"W/\"datetime''2021-05-04T14%3A50%3A10.7782844Z''\"","PartitionKey":"batch_inserts","RowKey":"8","Timestamp":"2021-05-04T14:50:10.7782844Z","test":true,"test2":"value","test3":3,"test4":1234567890},{"odata.etag":"W/\"datetime''2021-05-04T14%3A50%3A10.7782844Z''\"","PartitionKey":"batch_inserts","RowKey":"9","Timestamp":"2021-05-04T14:50:10.7782844Z","test":true,"test2":"value","test3":3,"test4":1234567890}]}'
+ headers:
+ cache-control:
+ - no-cache
+ content-type:
+ - application/json;odata=minimalmetadata;streaming=true;charset=utf-8
+ date:
+ - Tue, 04 May 2021 14:50:10 GMT
+ server:
+ - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0
+ transfer-encoding:
+ - chunked
+ x-content-type-options:
+ - nosniff
x-ms-version:
- '2019-02-02'
status:
- code: 404
- message: The specified resource does not exist.
+ code: 200
+ message: OK
- request:
body: null
headers:
@@ -211,11 +304,11 @@ interactions:
Content-Length:
- '0'
Date:
- - Fri, 05 Mar 2021 16:54:45 GMT
+ - Tue, 04 May 2021 14:50:13 GMT
User-Agent:
- - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0)
+ - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0)
x-ms-date:
- - Fri, 05 Mar 2021 16:54:45 GMT
+ - Tue, 04 May 2021 14:50:13 GMT
x-ms-version:
- '2019-02-02'
method: DELETE
@@ -229,7 +322,7 @@ interactions:
content-length:
- '0'
date:
- - Fri, 05 Mar 2021 16:54:43 GMT
+ - Tue, 04 May 2021 14:50:11 GMT
server:
- Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0
x-content-type-options:
diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_table_batch.test_new_invalid_key.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_table_batch.test_new_invalid_key.yaml
index 9020e81a4a6d..d2b4e314bb4a 100644
--- a/sdk/tables/azure-data-tables/tests/recordings/test_table_batch.test_new_invalid_key.yaml
+++ b/sdk/tables/azure-data-tables/tests/recordings/test_table_batch.test_new_invalid_key.yaml
@@ -1,64 +1,60 @@
interactions:
- request:
- body: "--batch_bd3a859d-cba6-419a-b2bc-e33095037bf2\r\nContent-Type: multipart/mixed;\
- \ boundary=changeset_7d70e32d-ff86-487f-a866-ff12401112ba\r\n\r\n--changeset_7d70e32d-ff86-487f-a866-ff12401112ba\r\
+ body: "--batch_a7d1e4a3-d81b-47be-a6bd-526144d0d5b3\r\nContent-Type: multipart/mixed;\
+ \ boundary=changeset_41ffbf44-accb-44c5-a011-77bbb7b0231f\r\n\r\n--changeset_41ffbf44-accb-44c5-a011-77bbb7b0231f\r\
\nContent-Type: application/http\r\nContent-Transfer-Encoding: binary\r\nContent-ID:\
\ 0\r\n\r\nPOST https://seankaneprim.table.core.windows.net/uttable1d970f0e\
\ HTTP/1.1\r\nx-ms-version: 2019-02-02\r\nDataServiceVersion: 3.0\r\nPrefer:\
\ return-no-content\r\nContent-Type: application/json;odata=nometadata\r\nAccept:\
- \ application/json;odata=minimalmetadata\r\nContent-Length: 576\r\nx-ms-date:\
- \ Fri, 18 Dec 2020 15:42:30 GMT\r\nDate: Fri, 18 Dec 2020 15:42:30 GMT\r\nx-ms-client-request-id:\
- \ a34274b4-4147-11eb-8075-58961df361d1\r\n\r\n{\"PartitionKey\": \"001\", \"\
- PartitionKey@odata.type\": \"Edm.String\", \"RowKey\": \"batch_negative_1\"\
- , \"RowKey@odata.type\": \"Edm.String\", \"age\": 39, \"sex\": \"male\", \"\
- sex@odata.type\": \"Edm.String\", \"married\": true, \"deceased\": false, \"\
- ratio\": 3.1, \"evenratio\": 3.0, \"large\": 933311100, \"Birthday\": \"1973-10-04T00:00:00Z\"\
- , \"Birthday@odata.type\": \"Edm.DateTime\", \"birthday\": \"1970-10-04T00:00:00Z\"\
- , \"birthday@odata.type\": \"Edm.DateTime\", \"binary\": \"YmluYXJ5\", \"binary@odata.type\"\
- : \"Edm.Binary\", \"other\": 20, \"clsid\": \"c9da6455-213d-42c9-9a79-3e9149a57833\"\
- , \"clsid@odata.type\": \"Edm.Guid\"}\r\n--changeset_7d70e32d-ff86-487f-a866-ff12401112ba--\r\
- \n\r\n--batch_bd3a859d-cba6-419a-b2bc-e33095037bf2--\r\n"
+ \ application/json;odata=minimalmetadata\r\nContent-Length: 590\r\nx-ms-date:\
+ \ Tue, 04 May 2021 14:55:37 GMT\r\nDate: Tue, 04 May 2021 14:55:37 GMT\r\n\r\
+ \n{\"PartitionKey\": \"001\", \"PartitionKey@odata.type\": \"Edm.String\", \"\
+ RowKey\": \"batch_negative_1\", \"RowKey@odata.type\": \"Edm.String\", \"age\"\
+ : 39, \"sex\": \"male\", \"sex@odata.type\": \"Edm.String\", \"married\": true,\
+ \ \"deceased\": false, \"ratio\": 3.1, \"evenratio\": 3.0, \"large\": 933311100,\
+ \ \"Birthday\": \"1973-10-04T00:00:00.000000Z\", \"Birthday@odata.type\": \"\
+ Edm.DateTime\", \"birthday\": \"1970-10-04T00:00:00.000000Z\", \"birthday@odata.type\"\
+ : \"Edm.DateTime\", \"binary\": \"YmluYXJ5\", \"binary@odata.type\": \"Edm.Binary\"\
+ , \"other\": 20, \"clsid\": \"c9da6455-213d-42c9-9a79-3e9149a57833\", \"clsid@odata.type\"\
+ : \"Edm.Guid\"}\r\n--changeset_41ffbf44-accb-44c5-a011-77bbb7b0231f--\r\n\r\n\
+ --batch_a7d1e4a3-d81b-47be-a6bd-526144d0d5b3--\r\n"
headers:
Accept:
- - '*/*'
+ - application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- - '1364'
+ - '1316'
Content-Type:
- - multipart/mixed; boundary=batch_bd3a859d-cba6-419a-b2bc-e33095037bf2
+ - multipart/mixed; boundary=batch_a7d1e4a3-d81b-47be-a6bd-526144d0d5b3
DataServiceVersion:
- '3.0'
Date:
- - Fri, 18 Dec 2020 15:42:30 GMT
+ - Tue, 04 May 2021 14:55:37 GMT
MaxDataServiceVersion:
- 3.0;NetFx
User-Agent:
- - azsdk-python-data-tables/12.0.0b4 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0)
+ - azsdk-python-data-tables/12.0.0b7 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0)
x-ms-date:
- - Fri, 18 Dec 2020 15:42:30 GMT
+ - Tue, 04 May 2021 14:55:37 GMT
x-ms-version:
- '2019-02-02'
method: POST
uri: https://fake_table_account.table.core.windows.net/$batch
response:
body:
- string: 'AuthenticationFailedServer failed to authenticate the request. Make sure the
- value of Authorization header is formed correctly including the signature.
-
- RequestId:42b2def8-3002-0065-3b54-d50d5d000000
-
- Time:2020-12-18T15:42:31.0162251Z'
+ string: '{"odata.error":{"code":"AuthenticationFailed","message":{"lang":"en-US","value":"Server
+ failed to authenticate the request. Make sure the value of Authorization header
+ is formed correctly including the signature.\nRequestId:446bf59a-e002-0076-74f5-40506c000000\nTime:2021-05-04T14:55:35.4961294Z"}}}'
headers:
content-length:
- - '419'
+ - '299'
content-type:
- - application/xml
+ - application/json
date:
- - Fri, 18 Dec 2020 15:42:30 GMT
+ - Tue, 04 May 2021 14:55:35 GMT
server:
- Microsoft-HTTPAPI/2.0
x-ms-error-code:
diff --git a/sdk/tables/azure-data-tables/tests/test_retry.py b/sdk/tables/azure-data-tables/tests/test_retry.py
index 1ca1388c49b4..a0b17ae09979 100644
--- a/sdk/tables/azure-data-tables/tests/test_retry.py
+++ b/sdk/tables/azure-data-tables/tests/test_retry.py
@@ -31,7 +31,7 @@
RetryCounter
)
-from preparers import TablesPreparer
+from preparers import tables_decorator
class RetryRequestTransport(RequestsTransport):
@@ -39,7 +39,7 @@ class RetryRequestTransport(RequestsTransport):
def __init__(self, *args, **kwargs):
super(RetryRequestTransport, self).__init__(*args, **kwargs)
self.count = 0
-
+
def send(self, request, **kwargs):
self.count += 1
response = super(RetryRequestTransport, self).send(request, **kwargs)
@@ -81,7 +81,7 @@ def _tear_down(self, **kwargs):
pass
# --Test Cases --------------------------------------------
- @TablesPreparer()
+ @tables_decorator
def test_retry_on_server_error(self, tables_storage_account_name, tables_primary_storage_account_key):
self._set_up(tables_storage_account_name, tables_primary_storage_account_key, default_table=False)
try:
@@ -96,7 +96,7 @@ def test_retry_on_server_error(self, tables_storage_account_name, tables_primary
self.ts.delete_table(new_table_name)
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_retry_on_timeout(self, tables_storage_account_name, tables_primary_storage_account_key):
self._set_up(
tables_storage_account_name,
@@ -115,7 +115,7 @@ def test_retry_on_timeout(self, tables_storage_account_name, tables_primary_stor
self._tear_down()
@pytest.mark.live_test_only
- @TablesPreparer()
+ @tables_decorator
def test_retry_on_socket_timeout(self, tables_storage_account_name, tables_primary_storage_account_key):
retry_transport = RetryRequestTransport(connection_timeout=11, read_timeout=0.000000000001)
self._set_up(
@@ -125,7 +125,7 @@ def test_retry_on_socket_timeout(self, tables_storage_account_name, tables_prima
default_table=False,
retry_mode=RetryMode.Fixed,
retry_backoff_factor=1)
-
+
new_table_name = self.get_resource_name('uttable')
try:
with pytest.raises(AzureError) as error:
@@ -139,7 +139,7 @@ def test_retry_on_socket_timeout(self, tables_storage_account_name, tables_prima
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_no_retry(self, tables_storage_account_name, tables_primary_storage_account_key):
self._set_up(tables_storage_account_name, tables_primary_storage_account_key, retry_total=0, default_table=False)
diff --git a/sdk/tables/azure-data-tables/tests/test_retry_async.py b/sdk/tables/azure-data-tables/tests/test_retry_async.py
index bc396831de61..728d44c1855f 100644
--- a/sdk/tables/azure-data-tables/tests/test_retry_async.py
+++ b/sdk/tables/azure-data-tables/tests/test_retry_async.py
@@ -29,7 +29,7 @@
RetryCounter
)
-from preparers import TablesPreparer
+from async_preparers import tables_decorator_async
class RetryAioHttpTransport(AioHttpTransport):
@@ -37,7 +37,7 @@ class RetryAioHttpTransport(AioHttpTransport):
def __init__(self, *args, **kwargs):
super(RetryAioHttpTransport, self).__init__(*args, **kwargs)
self.count = 0
-
+
async def send(self, request, **kwargs):
self.count += 1
response = await super(RetryAioHttpTransport, self).send(request, **kwargs)
@@ -80,7 +80,7 @@ async def _tear_down(self, **kwargs):
pass
# --Test Cases --------------------------------------------
- @TablesPreparer()
+ @tables_decorator_async
async def test_retry_on_server_error_async(self, tables_storage_account_name, tables_primary_storage_account_key):
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key, default_table=False)
try:
@@ -95,7 +95,7 @@ async def test_retry_on_server_error_async(self, tables_storage_account_name, ta
await self.ts.delete_table(new_table_name)
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_retry_on_timeout_async(self, tables_storage_account_name, tables_primary_storage_account_key):
await self._set_up(
tables_storage_account_name,
@@ -114,7 +114,7 @@ async def test_retry_on_timeout_async(self, tables_storage_account_name, tables_
await self._tear_down()
@pytest.mark.live_test_only
- @TablesPreparer()
+ @tables_decorator_async
async def test_retry_on_socket_timeout_async(self, tables_storage_account_name, tables_primary_storage_account_key):
retry_transport = RetryAioHttpTransport(connection_timeout=11, read_timeout=0.000000000001)
await self._set_up(
@@ -124,7 +124,7 @@ async def test_retry_on_socket_timeout_async(self, tables_storage_account_name,
retry_backoff_factor=1,
transport=retry_transport,
default_table=False)
-
+
new_table_name = self.get_resource_name('uttable')
try:
with pytest.raises(AzureError) as error:
@@ -138,7 +138,7 @@ async def test_retry_on_socket_timeout_async(self, tables_storage_account_name,
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_no_retry_async(self, tables_storage_account_name, tables_primary_storage_account_key):
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key, retry_total=0, default_table=False)
diff --git a/sdk/tables/azure-data-tables/tests/test_table.py b/sdk/tables/azure-data-tables/tests/test_table.py
index 1a4401132907..e717cb3be26b 100644
--- a/sdk/tables/azure-data-tables/tests/test_table.py
+++ b/sdk/tables/azure-data-tables/tests/test_table.py
@@ -29,7 +29,7 @@
generate_account_sas,
ResourceTypes
)
-from azure.core.credentials import AzureSasCredential
+from azure.core.credentials import AzureNamedKeyCredential, AzureSasCredential
from azure.core.pipeline import Pipeline
from azure.core.pipeline.policies import (
HeadersPolicy,
@@ -42,7 +42,7 @@
)
from _shared.testcase import TableTestCase
-from preparers import TablesPreparer
+from preparers import tables_decorator, tables_decorator
# ------------------------------------------------------------------------------
TEST_TABLE_PREFIX = 'pytablesync'
@@ -83,7 +83,7 @@ def _delete_all_tables(self, ts):
# --Test cases for tables --------------------------------------------------
- @TablesPreparer()
+ @tables_decorator
def test_create_properties(self, tables_storage_account_name, tables_primary_storage_account_key):
# # Arrange
account_url = self.account_url(tables_storage_account_name, "table")
@@ -106,7 +106,7 @@ def test_create_properties(self, tables_storage_account_name, tables_primary_sto
ps = ts.get_service_properties()
ts.delete_table(table_name)
- @TablesPreparer()
+ @tables_decorator
def test_create_table(self, tables_storage_account_name, tables_primary_storage_account_key):
# # Arrange
account_url = self.account_url(tables_storage_account_name, "table")
@@ -121,7 +121,7 @@ def test_create_table(self, tables_storage_account_name, tables_primary_storage_
assert created.table_name == table_name
ts.delete_table(table_name)
- @TablesPreparer()
+ @tables_decorator
def test_create_table_fail_on_exist(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
account_url = self.account_url(tables_storage_account_name, "table")
@@ -140,7 +140,7 @@ def test_create_table_fail_on_exist(self, tables_storage_account_name, tables_pr
assert created is not None
ts.delete_table(table_name)
- @TablesPreparer()
+ @tables_decorator
def test_query_tables_per_page(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
account_url = self.account_url(tables_storage_account_name, "table")
@@ -172,7 +172,7 @@ def test_query_tables_per_page(self, tables_storage_account_name, tables_primary
if self.is_live:
self.sleep(10) # wait for tables to be deleted before proceeding
- @TablesPreparer()
+ @tables_decorator
def test_create_table_if_exists(self, tables_storage_account_name, tables_primary_storage_account_key):
account_url = self.account_url(tables_storage_account_name, "table")
ts = self.create_client_from_credential(TableServiceClient, tables_primary_storage_account_key, account_url=account_url)
@@ -186,7 +186,7 @@ def test_create_table_if_exists(self, tables_storage_account_name, tables_primar
assert t0.table_name == t1.table_name
ts.delete_table(table_name)
- @TablesPreparer()
+ @tables_decorator
def test_create_table_if_exists_new_table(self, tables_storage_account_name, tables_primary_storage_account_key):
account_url = self.account_url(tables_storage_account_name, "table")
ts = self.create_client_from_credential(TableServiceClient, tables_primary_storage_account_key, account_url=account_url)
@@ -198,7 +198,7 @@ def test_create_table_if_exists_new_table(self, tables_storage_account_name, tab
assert t.table_name == table_name
ts.delete_table(table_name)
- @TablesPreparer()
+ @tables_decorator
def test_query_tables(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
account_url = self.account_url(tables_storage_account_name, "table")
@@ -220,7 +220,7 @@ def test_query_tables(self, tables_storage_account_name, tables_primary_storage_
if self.is_live:
self.sleep(10) # wait for tables to be deleted before proceeding
- @TablesPreparer()
+ @tables_decorator
def test_query_tables_with_filter(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
account_url = self.account_url(tables_storage_account_name, "table")
@@ -244,7 +244,7 @@ def test_query_tables_with_filter(self, tables_storage_account_name, tables_prim
if self.is_live:
self.sleep(10) # wait for tables to be deleted before proceeding
- @TablesPreparer()
+ @tables_decorator
def test_query_tables_with_num_results(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
prefix = 'listtable'
@@ -273,7 +273,7 @@ def test_query_tables_with_num_results(self, tables_storage_account_name, tables
if self.is_live:
self.sleep(10) # wait for tables to be deleted before proceeding
- @TablesPreparer()
+ @tables_decorator
def test_query_tables_with_marker(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
account_url = self.account_url(tables_storage_account_name, "table")
@@ -303,7 +303,7 @@ def test_query_tables_with_marker(self, tables_storage_account_name, tables_prim
if self.is_live:
self.sleep(10) # wait for tables to be deleted before proceeding
- @TablesPreparer()
+ @tables_decorator
def test_delete_table_with_existing_table(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
account_url = self.account_url(tables_storage_account_name, "table")
@@ -318,7 +318,7 @@ def test_delete_table_with_existing_table(self, tables_storage_account_name, tab
assert deleted is None
assert len(existing) == 0
- @TablesPreparer()
+ @tables_decorator
def test_delete_table_with_non_existing_table_fail_not_exist(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
account_url = self.account_url(tables_storage_account_name, "table")
@@ -329,7 +329,7 @@ def test_delete_table_with_non_existing_table_fail_not_exist(self, tables_storag
with pytest.raises(HttpResponseError):
ts.delete_table(table_name)
- @TablesPreparer()
+ @tables_decorator
def test_get_table_acl(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
url = self.account_url(tables_storage_account_name, "table")
@@ -346,7 +346,7 @@ def test_get_table_acl(self, tables_storage_account_name, tables_primary_storage
finally:
ts.delete_table(table.table_name)
- @TablesPreparer()
+ @tables_decorator
def test_set_table_acl_with_empty_signed_identifiers(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
account_url = self.account_url(tables_storage_account_name, "table")
@@ -365,7 +365,7 @@ def test_set_table_acl_with_empty_signed_identifiers(self, tables_storage_accoun
finally:
ts.delete_table(table.table_name)
- @TablesPreparer()
+ @tables_decorator
def test_set_table_acl_with_empty_signed_identifier(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
account_url = self.account_url(tables_storage_account_name, "table")
@@ -387,7 +387,7 @@ def test_set_table_acl_with_empty_signed_identifier(self, tables_storage_account
finally:
ts.delete_table(table.table_name)
- @TablesPreparer()
+ @tables_decorator
def test_set_table_acl_with_signed_identifiers(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
account_url = self.account_url(tables_storage_account_name, "table")
@@ -412,7 +412,7 @@ def test_set_table_acl_with_signed_identifiers(self, tables_storage_account_name
finally:
ts.delete_table(table.table_name)
- @TablesPreparer()
+ @tables_decorator
def test_set_table_acl_too_many_ids(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
account_url = self.account_url(tables_storage_account_name, "table")
@@ -433,7 +433,7 @@ def test_set_table_acl_too_many_ids(self, tables_storage_account_name, tables_pr
ts.delete_table(table.table_name)
@pytest.mark.live_test_only
- @TablesPreparer()
+ @tables_decorator
def test_account_sas(self, tables_storage_account_name, tables_primary_storage_account_key):
# SAS URL is calculated from storage key, so this test runs live only
@@ -454,7 +454,6 @@ def test_account_sas(self, tables_storage_account_name, tables_primary_storage_a
table.upsert_entity(mode=UpdateMode.MERGE, entity=entity)
token = generate_account_sas(
- tables_storage_account_name,
tables_primary_storage_account_key,
resource_types=ResourceTypes(object=True),
permission=AccountSasPermissions(read=True),
@@ -482,11 +481,12 @@ def test_account_sas(self, tables_storage_account_name, tables_primary_storage_a
class TestTablesUnitTest(TableTestCase):
tables_storage_account_name = "fake_storage_account"
tables_primary_storage_account_key = "fakeXMZjnGsZGvd4bVr3Il5SeHA"
+ credential = AzureNamedKeyCredential(name=tables_storage_account_name, key=tables_primary_storage_account_key)
def test_unicode_create_table_unicode_name(self):
# Arrange
account_url = self.account_url(self.tables_storage_account_name, "table")
- tsc = TableServiceClient(account_url, credential=self.tables_primary_storage_account_key)
+ tsc = TableServiceClient(account_url, credential=self.credential)
table_name = u'啊齄丂狛狜'
@@ -500,7 +500,7 @@ def test_unicode_create_table_unicode_name(self):
def test_create_table_invalid_name(self):
# Arrange
account_url = self.account_url(self.tables_storage_account_name, "table")
- tsc = TableServiceClient(account_url, credential=self.tables_primary_storage_account_key)
+ tsc = TableServiceClient(account_url, credential=self.credential)
invalid_table_name = "my_table"
with pytest.raises(ValueError) as excinfo:
@@ -512,7 +512,7 @@ def test_create_table_invalid_name(self):
def test_delete_table_invalid_name(self):
# Arrange
account_url = self.account_url(self.tables_storage_account_name, "table")
- tsc = TableServiceClient(account_url, credential=self.tables_primary_storage_account_key)
+ tsc = TableServiceClient(account_url, credential=self.credential)
invalid_table_name = "my_table"
with pytest.raises(ValueError) as excinfo:
@@ -523,10 +523,10 @@ def test_delete_table_invalid_name(self):
def test_azurite_url(self):
account_url = "https://127.0.0.1:10002/my_account"
- tsc = TableServiceClient(account_url, credential=self.tables_primary_storage_account_key)
+ tsc = TableServiceClient(account_url, credential=self.credential)
assert tsc.account_name == "my_account"
assert tsc.url == "https://127.0.0.1:10002/my_account"
assert tsc.location_mode == "primary"
- assert tsc.credential.account_key == self.tables_primary_storage_account_key
- assert tsc.credential.account_name == "my_account"
+ assert tsc.credential.named_key.key == self.credential.named_key.key
+ assert tsc.credential.named_key.name == self.credential.named_key.name
diff --git a/sdk/tables/azure-data-tables/tests/test_table_async.py b/sdk/tables/azure-data-tables/tests/test_table_async.py
index d09a85635675..da068189eaac 100644
--- a/sdk/tables/azure-data-tables/tests/test_table_async.py
+++ b/sdk/tables/azure-data-tables/tests/test_table_async.py
@@ -7,7 +7,7 @@
from devtools_testutils import AzureTestCase
-from azure.core.credentials import AzureSasCredential
+from azure.core.credentials import AzureSasCredential, AzureNamedKeyCredential
from azure.core.exceptions import ResourceNotFoundError, ResourceExistsError
from azure.data.tables import (
AccessPolicy,
@@ -20,7 +20,7 @@
from azure.data.tables.aio import TableServiceClient, TableClient
from _shared.asynctestcase import AsyncTableTestCase
-from preparers import TablesPreparer
+from async_preparers import tables_decorator_async
TEST_TABLE_PREFIX = 'pytableasync'
@@ -52,7 +52,7 @@ async def _delete_table(self, ts, table):
pass
# --Test cases for tables --------------------------------------------------
- @TablesPreparer()
+ @tables_decorator_async
async def test_create_table(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
account_url = self.account_url(tables_storage_account_name, "table")
@@ -67,7 +67,7 @@ async def test_create_table(self, tables_storage_account_name, tables_primary_st
assert created.table_name == table_name
await ts.delete_table(table_name=table_name)
- @TablesPreparer()
+ @tables_decorator_async
async def test_create_table_fail_on_exist(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
account_url = self.account_url(tables_storage_account_name, "table")
@@ -86,7 +86,7 @@ async def test_create_table_fail_on_exist(self, tables_storage_account_name, tab
assert isinstance(created, TableClient)
await ts.delete_table(table_name=table_name)
- @TablesPreparer()
+ @tables_decorator_async
async def test_query_tables_per_page(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
account_url = self.account_url(tables_storage_account_name, "table")
@@ -115,7 +115,7 @@ async def test_query_tables_per_page(self, tables_storage_account_name, tables_p
for i in range(5):
await ts.delete_table(table_name + str(i))
- @TablesPreparer()
+ @tables_decorator_async
async def test_list_tables(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
account_url = self.account_url(tables_storage_account_name, "table")
@@ -136,7 +136,7 @@ async def test_list_tables(self, tables_storage_account_name, tables_primary_sto
assert tables[0] is not None
await ts.delete_table(table.table_name)
- @TablesPreparer()
+ @tables_decorator_async
async def test_query_tables_with_filter(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
account_url = self.account_url(tables_storage_account_name, "table")
@@ -157,7 +157,7 @@ async def test_query_tables_with_filter(self, tables_storage_account_name, table
assert table_item.name is not None
await ts.delete_table(table.table_name)
- @TablesPreparer()
+ @tables_decorator_async
async def test_list_tables_with_num_results(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
prefix = 'listtable'
@@ -184,7 +184,7 @@ async def test_list_tables_with_num_results(self, tables_storage_account_name, t
assert len(small_page) == 2
assert len(big_page) >= 4
- @TablesPreparer()
+ @tables_decorator_async
async def test_list_tables_with_marker(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
account_url = self.account_url(tables_storage_account_name, "table")
@@ -217,7 +217,7 @@ async def test_list_tables_with_marker(self, tables_storage_account_name, tables
assert tables2_len == 2
assert tables1 != tables2
- @TablesPreparer()
+ @tables_decorator_async
async def test_delete_table_with_existing_table(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
account_url = self.account_url(tables_storage_account_name, "table")
@@ -233,7 +233,7 @@ async def test_delete_table_with_existing_table(self, tables_storage_account_nam
tables.append(e)
assert tables == []
- @TablesPreparer()
+ @tables_decorator_async
async def test_delete_table_with_non_existing_table_fail_not_exist(self, tables_storage_account_name,
tables_primary_storage_account_key):
# Arrange
@@ -247,7 +247,7 @@ async def test_delete_table_with_non_existing_table_fail_not_exist(self, tables_
# Assert
- @TablesPreparer()
+ @tables_decorator_async
async def test_get_table_acl(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
account_url = self.account_url(tables_storage_account_name, "table")
@@ -264,7 +264,7 @@ async def test_get_table_acl(self, tables_storage_account_name, tables_primary_s
finally:
await ts.delete_table(table.table_name)
- @TablesPreparer()
+ @tables_decorator_async
async def test_set_table_acl_with_empty_signed_identifiers(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
account_url = self.account_url(tables_storage_account_name, "table")
@@ -282,7 +282,7 @@ async def test_set_table_acl_with_empty_signed_identifiers(self, tables_storage_
finally:
await ts.delete_table(table.table_name)
- @TablesPreparer()
+ @tables_decorator_async
async def test_set_table_acl_with_empty_signed_identifier(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
url = self.account_url(tables_storage_account_name, "table")
@@ -303,7 +303,7 @@ async def test_set_table_acl_with_empty_signed_identifier(self, tables_storage_a
# self._delete_table(table)
await ts.delete_table(table.table_name)
- @TablesPreparer()
+ @tables_decorator_async
async def test_set_table_acl_with_signed_identifiers(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
url = self.account_url(tables_storage_account_name, "table")
@@ -327,7 +327,7 @@ async def test_set_table_acl_with_signed_identifiers(self, tables_storage_accoun
finally:
await ts.delete_table(table.table_name)
- @TablesPreparer()
+ @tables_decorator_async
async def test_set_table_acl_too_many_ids(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
url = self.account_url(tables_storage_account_name, "table")
@@ -346,7 +346,7 @@ async def test_set_table_acl_too_many_ids(self, tables_storage_account_name, tab
await ts.delete_table(table.table_name)
@pytest.mark.live_test_only
- @TablesPreparer()
+ @tables_decorator_async
async def test_account_sas(self, tables_storage_account_name, tables_primary_storage_account_key):
# SAS URL is calculated from storage key, so this test runs live only
@@ -367,7 +367,6 @@ async def test_account_sas(self, tables_storage_account_name, tables_primary_sto
await table.upsert_entity(entity=entity)
token = generate_account_sas(
- tables_storage_account_name,
tables_primary_storage_account_key,
resource_types=ResourceTypes(object=True),
permission=AccountSasPermissions(read=True),
@@ -396,12 +395,13 @@ async def test_account_sas(self, tables_storage_account_name, tables_primary_sto
class TestTablesUnitTest(AsyncTableTestCase):
tables_storage_account_name = "fake_storage_account"
tables_primary_storage_account_key = "fakeXMZjnGsZGvd4bVr3Il5SeHA"
+ credential = AzureNamedKeyCredential(name=tables_storage_account_name, key=tables_primary_storage_account_key)
@pytest.mark.asyncio
async def test_unicode_create_table_unicode_name(self):
# Arrange
account_url = self.account_url(self.tables_storage_account_name, "table")
- tsc = TableServiceClient(account_url, credential=self.tables_primary_storage_account_key)
+ tsc = TableServiceClient(account_url, credential=self.credential)
table_name = u'啊齄丂狛狜'
@@ -416,7 +416,7 @@ async def test_unicode_create_table_unicode_name(self):
async def test_create_table_invalid_name(self):
# Arrange
account_url = self.account_url(self.tables_storage_account_name, "table")
- tsc = TableServiceClient(account_url, credential=self.tables_primary_storage_account_key)
+ tsc = TableServiceClient(account_url, credential=self.credential)
invalid_table_name = "my_table"
with pytest.raises(ValueError) as excinfo:
@@ -429,7 +429,7 @@ async def test_create_table_invalid_name(self):
async def test_delete_table_invalid_name(self):
# Arrange
account_url = self.account_url(self.tables_storage_account_name, "table")
- tsc = TableServiceClient(account_url, credential=self.tables_primary_storage_account_key)
+ tsc = TableServiceClient(account_url, credential=self.credential)
invalid_table_name = "my_table"
with pytest.raises(ValueError) as excinfo:
@@ -440,10 +440,10 @@ async def test_delete_table_invalid_name(self):
def test_azurite_url(self):
account_url = "https://127.0.0.1:10002/my_account"
- tsc = TableServiceClient(account_url, credential=self.tables_primary_storage_account_key)
+ tsc = TableServiceClient(account_url, credential=self.credential)
assert tsc.account_name == "my_account"
assert tsc.url == "https://127.0.0.1:10002/my_account"
assert tsc.location_mode == "primary"
- assert tsc.credential.account_key == self.tables_primary_storage_account_key
- assert tsc.credential.account_name == "my_account"
+ assert tsc.credential.named_key.key == self.credential.named_key.key
+ assert tsc.credential.named_key.name == self.credential.named_key.name
diff --git a/sdk/tables/azure-data-tables/tests/test_table_batch.py b/sdk/tables/azure-data-tables/tests/test_table_batch.py
index 400e12d1ebc5..97cf32cba1eb 100644
--- a/sdk/tables/azure-data-tables/tests/test_table_batch.py
+++ b/sdk/tables/azure-data-tables/tests/test_table_batch.py
@@ -17,7 +17,7 @@
from devtools_testutils import AzureTestCase
from azure.core import MatchConditions
-from azure.core.credentials import AzureSasCredential
+from azure.core.credentials import AzureNamedKeyCredential, AzureSasCredential
from azure.core.exceptions import (
ResourceExistsError,
ResourceNotFoundError,
@@ -39,7 +39,7 @@
)
from _shared.testcase import TableTestCase
-from preparers import TablesPreparer
+from preparers import tables_decorator
#------------------------------------------------------------------------------
TEST_TABLE_PREFIX = 'table'
@@ -176,7 +176,7 @@ def _assert_valid_batch_transaction(self, transaction, length):
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @TablesPreparer()
+ @tables_decorator
def test_batch_single_insert(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -207,7 +207,7 @@ def test_batch_single_insert(self, tables_storage_account_name, tables_primary_s
self._tear_down()
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @TablesPreparer()
+ @tables_decorator
def test_batch_single_update(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -242,7 +242,7 @@ def test_batch_single_update(self, tables_storage_account_name, tables_primary_s
self._tear_down()
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @TablesPreparer()
+ @tables_decorator
def test_batch_update(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -279,7 +279,7 @@ def test_batch_update(self, tables_storage_account_name, tables_primary_storage_
self._tear_down()
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @TablesPreparer()
+ @tables_decorator
def test_batch_merge(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -318,7 +318,7 @@ def test_batch_merge(self, tables_storage_account_name, tables_primary_storage_a
self._tear_down()
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @TablesPreparer()
+ @tables_decorator
def test_batch_update_if_match(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -346,7 +346,7 @@ def test_batch_update_if_match(self, tables_storage_account_name, tables_primary
self._tear_down()
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @TablesPreparer()
+ @tables_decorator
def test_batch_update_if_doesnt_match(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -372,7 +372,7 @@ def test_batch_update_if_doesnt_match(self, tables_storage_account_name, tables_
self._tear_down()
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @TablesPreparer()
+ @tables_decorator
def test_batch_single_op_if_doesnt_match(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -414,7 +414,7 @@ def test_batch_single_op_if_doesnt_match(self, tables_storage_account_name, tabl
self._tear_down()
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @TablesPreparer()
+ @tables_decorator
def test_batch_insert_replace(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -444,7 +444,7 @@ def test_batch_insert_replace(self, tables_storage_account_name, tables_primary_
self._tear_down()
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @TablesPreparer()
+ @tables_decorator
def test_batch_insert_merge(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -474,7 +474,7 @@ def test_batch_insert_merge(self, tables_storage_account_name, tables_primary_st
self._tear_down()
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @TablesPreparer()
+ @tables_decorator
def test_batch_delete(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -506,7 +506,7 @@ def test_batch_delete(self, tables_storage_account_name, tables_primary_storage_
self._tear_down()
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @TablesPreparer()
+ @tables_decorator
def test_batch_inserts(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -541,7 +541,7 @@ def test_batch_inserts(self, tables_storage_account_name, tables_primary_storage
self._tear_down()
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @TablesPreparer()
+ @tables_decorator
def test_batch_all_operations_together(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -611,7 +611,7 @@ def test_batch_all_operations_together(self, tables_storage_account_name, tables
self._tear_down()
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @TablesPreparer()
+ @tables_decorator
def test_batch_reuse(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -649,7 +649,7 @@ def test_batch_reuse(self, tables_storage_account_name, tables_primary_storage_a
self._tear_down()
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @TablesPreparer()
+ @tables_decorator
def test_batch_same_row_operations_fail(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -677,7 +677,7 @@ def test_batch_same_row_operations_fail(self, tables_storage_account_name, table
self._tear_down()
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @TablesPreparer()
+ @tables_decorator
def test_batch_different_partition_operations_fail(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -702,7 +702,7 @@ def test_batch_different_partition_operations_fail(self, tables_storage_account_
self._tear_down()
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @TablesPreparer()
+ @tables_decorator
def test_batch_too_many_ops(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -725,7 +725,7 @@ def test_batch_too_many_ops(self, tables_storage_account_name, tables_primary_st
self._tear_down()
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @TablesPreparer()
+ @tables_decorator
def test_batch_different_partition_keys(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -742,7 +742,7 @@ def test_batch_different_partition_keys(self, tables_storage_account_name, table
self._tear_down()
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @TablesPreparer()
+ @tables_decorator
def test_new_non_existent_table(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -760,11 +760,12 @@ def test_new_non_existent_table(self, tables_storage_account_name, tables_primar
self._tear_down()
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @TablesPreparer()
+ @tables_decorator
def test_new_invalid_key(self, tables_storage_account_name, tables_primary_storage_account_key):
- # Arrange
- invalid_key = tables_primary_storage_account_key[0:-6] + "==" # cut off a bit from the end to invalidate
- self.ts = TableServiceClient(self.account_url(tables_storage_account_name, "table"), invalid_key)
+ invalid_key = tables_primary_storage_account_key.named_key.key[0:-6] + "==" # cut off a bit from the end to invalidate
+ tables_primary_storage_account_key = AzureNamedKeyCredential(tables_storage_account_name, invalid_key)
+ credential = AzureNamedKeyCredential(name=tables_storage_account_name, key=tables_primary_storage_account_key.named_key.key)
+ self.ts = TableServiceClient(self.account_url(tables_storage_account_name, "table"), credential)
self.table_name = self.get_resource_name('uttable')
self.table = self.ts.get_table_client(self.table_name)
@@ -776,7 +777,7 @@ def test_new_invalid_key(self, tables_storage_account_name, tables_primary_stora
resp = self.table.submit_transaction(batch)
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @TablesPreparer()
+ @tables_decorator
def test_new_delete_nonexistent_entity(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -793,14 +794,13 @@ def test_new_delete_nonexistent_entity(self, tables_storage_account_name, tables
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
@pytest.mark.live_test_only
- @TablesPreparer()
+ @tables_decorator
def test_batch_sas_auth(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
try:
token = generate_table_sas(
- tables_storage_account_name,
tables_primary_storage_account_key,
self.table_name,
permission=TableSasPermissions(add=True, read=True, update=True, delete=True),
@@ -843,7 +843,7 @@ def test_batch_sas_auth(self, tables_storage_account_name, tables_primary_storag
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
@pytest.mark.live_test_only # Request bodies are very large
- @TablesPreparer()
+ @tables_decorator
def test_batch_request_too_large(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
diff --git a/sdk/tables/azure-data-tables/tests/test_table_batch_async.py b/sdk/tables/azure-data-tables/tests/test_table_batch_async.py
index 924d94349759..1588bc38c9cb 100644
--- a/sdk/tables/azure-data-tables/tests/test_table_batch_async.py
+++ b/sdk/tables/azure-data-tables/tests/test_table_batch_async.py
@@ -38,7 +38,7 @@
)
from _shared.asynctestcase import AsyncTableTestCase
-from preparers import TablesPreparer
+from async_preparers import tables_decorator_async
#------------------------------------------------------------------------------
TEST_TABLE_PREFIX = 'table'
@@ -175,7 +175,7 @@ def _assert_valid_batch_transaction(self, transaction, length):
assert length == len(transaction)
#--Test cases for batch ---------------------------------------------
- @TablesPreparer()
+ @tables_decorator_async
async def test_batch_single_insert(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -205,7 +205,7 @@ async def test_batch_single_insert(self, tables_storage_account_name, tables_pri
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_batch_single_update(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -240,7 +240,7 @@ async def test_batch_single_update(self, tables_storage_account_name, tables_pri
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_batch_update(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -274,7 +274,7 @@ async def test_batch_update(self, tables_storage_account_name, tables_primary_st
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_batch_merge(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -312,7 +312,7 @@ async def test_batch_merge(self, tables_storage_account_name, tables_primary_sto
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_batch_update_if_match(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -339,7 +339,7 @@ async def test_batch_update_if_match(self, tables_storage_account_name, tables_p
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_batch_update_if_doesnt_match(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -365,7 +365,7 @@ async def test_batch_update_if_doesnt_match(self, tables_storage_account_name, t
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_batch_insert_replace(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -394,7 +394,7 @@ async def test_batch_insert_replace(self, tables_storage_account_name, tables_pr
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_batch_insert_merge(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -423,7 +423,7 @@ async def test_batch_insert_merge(self, tables_storage_account_name, tables_prim
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_batch_delete(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -455,7 +455,7 @@ async def test_batch_delete(self, tables_storage_account_name, tables_primary_st
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_batch_inserts(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -492,7 +492,7 @@ async def test_batch_inserts(self, tables_storage_account_name, tables_primary_s
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_batch_all_operations_together(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -564,7 +564,7 @@ async def test_batch_all_operations_together(self, tables_storage_account_name,
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_batch_same_row_operations_fail(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -589,7 +589,7 @@ async def test_batch_same_row_operations_fail(self, tables_storage_account_name,
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_batch_different_partition_operations_fail(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -614,7 +614,7 @@ async def test_batch_different_partition_operations_fail(self, tables_storage_ac
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_batch_too_many_ops(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -636,7 +636,7 @@ async def test_batch_too_many_ops(self, tables_storage_account_name, tables_prim
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_new_non_existent_table(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -653,7 +653,7 @@ async def test_new_non_existent_table(self, tables_storage_account_name, tables_
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_new_invalid_key(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
invalid_key = tables_primary_storage_account_key[0:-6] + "==" # cut off a bit from the end to invalidate
@@ -672,7 +672,7 @@ async def test_new_invalid_key(self, tables_storage_account_name, tables_primary
with pytest.raises(ClientAuthenticationError):
resp = await self.table.submit_transaction(batch)
- @TablesPreparer()
+ @tables_decorator_async
async def test_new_delete_nonexistent_entity(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -687,7 +687,7 @@ async def test_new_delete_nonexistent_entity(self, tables_storage_account_name,
await self._tear_down()
@pytest.mark.live_test_only
- @TablesPreparer()
+ @tables_decorator_async
async def test_batch_sas_auth(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -736,7 +736,7 @@ async def test_batch_sas_auth(self, tables_storage_account_name, tables_primary_
await self._tear_down()
@pytest.mark.live_test_only # Request bodies are very large
- @TablesPreparer()
+ @tables_decorator_async
async def test_batch_request_too_large(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
diff --git a/sdk/tables/azure-data-tables/tests/test_table_batch_cosmos.py b/sdk/tables/azure-data-tables/tests/test_table_batch_cosmos.py
index 068166391de0..aa0874eeb4ba 100644
--- a/sdk/tables/azure-data-tables/tests/test_table_batch_cosmos.py
+++ b/sdk/tables/azure-data-tables/tests/test_table_batch_cosmos.py
@@ -34,7 +34,7 @@
)
from _shared.testcase import TableTestCase, SLEEP_DELAY
-from preparers import CosmosPreparer
+from preparers import cosmos_decorator
#------------------------------------------------------------------------------
TEST_TABLE_PREFIX = 'table'
@@ -172,7 +172,7 @@ def _assert_valid_batch_transaction(self, transaction, length):
assert length == len(transaction)
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @CosmosPreparer()
+ @cosmos_decorator
def test_batch_insert(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -202,7 +202,7 @@ def test_batch_insert(self, tables_cosmos_account_name, tables_primary_cosmos_ac
self._tear_down()
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @CosmosPreparer()
+ @cosmos_decorator
def test_batch_update(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -237,7 +237,7 @@ def test_batch_update(self, tables_cosmos_account_name, tables_primary_cosmos_ac
self._tear_down()
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @CosmosPreparer()
+ @cosmos_decorator
def test_batch_merge(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -276,7 +276,7 @@ def test_batch_merge(self, tables_cosmos_account_name, tables_primary_cosmos_acc
self._tear_down()
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @CosmosPreparer()
+ @cosmos_decorator
def test_batch_update_if_match(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -304,7 +304,7 @@ def test_batch_update_if_match(self, tables_cosmos_account_name, tables_primary_
self._tear_down()
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @CosmosPreparer()
+ @cosmos_decorator
def test_batch_update_if_doesnt_match(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -330,7 +330,7 @@ def test_batch_update_if_doesnt_match(self, tables_cosmos_account_name, tables_p
self._tear_down()
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @CosmosPreparer()
+ @cosmos_decorator
def test_batch_insert_replace(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -360,7 +360,7 @@ def test_batch_insert_replace(self, tables_cosmos_account_name, tables_primary_c
self._tear_down()
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @CosmosPreparer()
+ @cosmos_decorator
def test_batch_insert_merge(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -390,7 +390,7 @@ def test_batch_insert_merge(self, tables_cosmos_account_name, tables_primary_cos
self._tear_down()
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @CosmosPreparer()
+ @cosmos_decorator
def test_batch_delete(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -422,7 +422,7 @@ def test_batch_delete(self, tables_cosmos_account_name, tables_primary_cosmos_ac
self._tear_down()
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @CosmosPreparer()
+ @cosmos_decorator
def test_batch_inserts(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -457,7 +457,7 @@ def test_batch_inserts(self, tables_cosmos_account_name, tables_primary_cosmos_a
self._tear_down()
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @CosmosPreparer()
+ @cosmos_decorator
def test_batch_all_operations_together(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -527,7 +527,7 @@ def test_batch_all_operations_together(self, tables_cosmos_account_name, tables_
self._tear_down()
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @CosmosPreparer()
+ @cosmos_decorator
def test_batch_different_partition_operations_fail(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -552,7 +552,7 @@ def test_batch_different_partition_operations_fail(self, tables_cosmos_account_n
self._tear_down()
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @CosmosPreparer()
+ @cosmos_decorator
def test_new_non_existent_table(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -570,7 +570,7 @@ def test_new_non_existent_table(self, tables_cosmos_account_name, tables_primary
self._tear_down()
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @CosmosPreparer()
+ @cosmos_decorator
def test_new_delete_nonexistent_entity(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -586,7 +586,7 @@ def test_new_delete_nonexistent_entity(self, tables_cosmos_account_name, tables_
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
@pytest.mark.live_test_only # Request bodies are very large
- @CosmosPreparer()
+ @cosmos_decorator
def test_batch_request_too_large(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
diff --git a/sdk/tables/azure-data-tables/tests/test_table_batch_cosmos_async.py b/sdk/tables/azure-data-tables/tests/test_table_batch_cosmos_async.py
index c62702d02b23..94a0074ef208 100644
--- a/sdk/tables/azure-data-tables/tests/test_table_batch_cosmos_async.py
+++ b/sdk/tables/azure-data-tables/tests/test_table_batch_cosmos_async.py
@@ -36,7 +36,7 @@
from _shared.testcase import SLEEP_DELAY
from _shared.asynctestcase import AsyncTableTestCase
-from preparers import CosmosPreparer
+from async_preparers import cosmos_decorator_async
#------------------------------------------------------------------------------
TEST_TABLE_PREFIX = 'table'
@@ -174,7 +174,7 @@ def _assert_valid_batch_transaction(self, transaction, length):
assert length == len(transaction)
#--Test cases for batch ---------------------------------------------
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_batch_single_insert(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -205,7 +205,7 @@ async def test_batch_single_insert(self, tables_cosmos_account_name, tables_prim
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_batch_single_update(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -240,7 +240,7 @@ async def test_batch_single_update(self, tables_cosmos_account_name, tables_prim
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_batch_update(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -274,7 +274,7 @@ async def test_batch_update(self, tables_cosmos_account_name, tables_primary_cos
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_batch_merge(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -312,7 +312,7 @@ async def test_batch_merge(self, tables_cosmos_account_name, tables_primary_cosm
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_batch_update_if_match(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -339,7 +339,7 @@ async def test_batch_update_if_match(self, tables_cosmos_account_name, tables_pr
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_batch_update_if_doesnt_match(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -366,7 +366,7 @@ async def test_batch_update_if_doesnt_match(self, tables_cosmos_account_name, ta
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_batch_insert_replace(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -395,7 +395,7 @@ async def test_batch_insert_replace(self, tables_cosmos_account_name, tables_pri
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_batch_insert_merge(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -424,7 +424,7 @@ async def test_batch_insert_merge(self, tables_cosmos_account_name, tables_prima
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_batch_delete(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -455,7 +455,7 @@ async def test_batch_delete(self, tables_cosmos_account_name, tables_primary_cos
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_batch_inserts(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -492,7 +492,7 @@ async def test_batch_inserts(self, tables_cosmos_account_name, tables_primary_co
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_batch_all_operations_together(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -564,7 +564,7 @@ async def test_batch_all_operations_together(self, tables_cosmos_account_name, t
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_batch_different_partition_operations_fail(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -589,7 +589,7 @@ async def test_batch_different_partition_operations_fail(self, tables_cosmos_acc
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_new_non_existent_table(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -607,7 +607,7 @@ async def test_new_non_existent_table(self, tables_cosmos_account_name, tables_p
await self._tear_down()
@pytest.mark.live_test_only
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_new_invalid_key(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
invalid_key = tables_primary_cosmos_account_key[0:-6] + "==" # cut off a bit from the end to invalidate
@@ -627,7 +627,7 @@ async def test_new_invalid_key(self, tables_cosmos_account_name, tables_primary_
with pytest.raises(ClientAuthenticationError):
resp = await self.table.submit_transaction(batch)
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_new_delete_nonexistent_entity(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -642,7 +642,7 @@ async def test_new_delete_nonexistent_entity(self, tables_cosmos_account_name, t
await self._tear_down()
@pytest.mark.live_test_only # Request bodies are very large
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_batch_request_too_large(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
diff --git a/sdk/tables/azure-data-tables/tests/test_table_client.py b/sdk/tables/azure-data-tables/tests/test_table_client.py
index af993338e060..8afa69f4b13a 100644
--- a/sdk/tables/azure-data-tables/tests/test_table_client.py
+++ b/sdk/tables/azure-data-tables/tests/test_table_client.py
@@ -10,13 +10,13 @@
from azure.data.tables import TableServiceClient, TableClient
from azure.data.tables import __version__ as VERSION
-from azure.core.exceptions import HttpResponseError
+from azure.core.credentials import AzureNamedKeyCredential
from _shared.testcase import (
TableTestCase
)
-from preparers import TablesPreparer
+from preparers import tables_decorator
# ------------------------------------------------------------------------------
@@ -31,7 +31,7 @@
class TestTableClient(AzureTestCase, TableTestCase):
- @TablesPreparer()
+ @tables_decorator
def test_user_agent_custom(self, tables_storage_account_name, tables_primary_storage_account_key):
custom_app = "TestApp/v1.0"
service = TableServiceClient(
@@ -67,7 +67,7 @@ def callback(response):
for table in tables:
count += 1
- @TablesPreparer()
+ @tables_decorator
def test_user_agent_append(self, tables_storage_account_name, tables_primary_storage_account_key):
service = TableServiceClient(self.account_url(tables_storage_account_name, "table"), credential=tables_primary_storage_account_key)
@@ -83,7 +83,7 @@ def callback(response):
for table in tables:
count += 1
- @TablesPreparer()
+ @tables_decorator
def test_user_agent_default(self, tables_storage_account_name, tables_primary_storage_account_key):
service = TableServiceClient(self.account_url(tables_storage_account_name, "table"), credential=tables_primary_storage_account_key)
@@ -106,13 +106,14 @@ def callback(response):
class TestTableUnitTests(TableTestCase):
tables_storage_account_name = "fake_storage_account"
tables_primary_storage_account_key = "fakeXMZjnGsZGvd4bVr3Il5SeHA"
+ credential = AzureNamedKeyCredential(name=tables_storage_account_name, key=tables_primary_storage_account_key)
# --Helpers-----------------------------------------------------------------
def validate_standard_account_endpoints(self, service, account_name, account_key):
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.account_name == account_name
+ assert service.credential.named_key.name == account_name
+ assert service.credential.named_key.key == account_key
assert ('{}.{}'.format(account_name, 'table.core.windows.net') in service.url) or ('{}.{}'.format(account_name, 'table.cosmos.azure.com') in service.url)
# --Direct Parameters Test Cases --------------------------------------------
@@ -122,11 +123,11 @@ def test_create_service_with_key(self):
for client, url in SERVICES.items():
# Act
service = client(
- self.account_url(self.tables_storage_account_name, url), credential=self.tables_primary_storage_account_key, table_name='foo')
+ self.account_url(self.tables_storage_account_name, url), credential=self.credential, table_name='foo')
# Assert
self.validate_standard_account_endpoints(service, self.tables_storage_account_name, self.tables_primary_storage_account_key)
- assert service.scheme == 'https'
+ assert service.scheme == 'https'
def test_create_service_with_connection_string(self):
@@ -137,7 +138,7 @@ def test_create_service_with_connection_string(self):
# Assert
self.validate_standard_account_endpoints(service, self.tables_storage_account_name, self.tables_primary_storage_account_key)
- assert service.scheme == 'https'
+ assert service.scheme == 'https'
def test_create_service_with_sas(self):
# Arrange
@@ -151,7 +152,7 @@ def test_create_service_with_sas(self):
# Assert
assert service is not None
- assert service.account_name == self.tables_storage_account_name
+ assert service.account_name == self.tables_storage_account_name
assert service.url.startswith('https://' + self.tables_storage_account_name + suffix)
assert service.url.endswith(token)
assert service.credential is None
@@ -162,13 +163,13 @@ def test_create_service_china(self):
# Act
url = self.account_url(self.tables_storage_account_name, "table").replace('core.windows.net', 'core.chinacloudapi.cn')
service = service_type[0](
- url, credential=self.tables_primary_storage_account_key, table_name='foo')
+ url, credential=self.credential, table_name='foo')
# Assert
assert service is not None
- assert service.account_name == self.tables_storage_account_name
- assert service.credential.account_name == self.tables_storage_account_name
- assert service.credential.account_key == self.tables_primary_storage_account_key
+ assert service.account_name == self.tables_storage_account_name
+ assert service.credential.named_key.name == self.tables_storage_account_name
+ assert service.credential.named_key.key == self.tables_primary_storage_account_key
assert service._primary_endpoint.startswith('https://{}.{}.core.chinacloudapi.cn'.format(self.tables_storage_account_name, "table"))
def test_create_service_protocol(self):
@@ -178,11 +179,11 @@ def test_create_service_protocol(self):
# Act
url = self.account_url(self.tables_storage_account_name, "table").replace('https', 'http')
service = service_type[0](
- url, credential=self.tables_primary_storage_account_key, table_name='foo')
+ url, credential=self.credential, table_name='foo')
# Assert
self.validate_standard_account_endpoints(service, self.tables_storage_account_name, self.tables_primary_storage_account_key)
- assert service.scheme == 'http'
+ assert service.scheme == 'http'
def test_create_service_empty_key(self):
# Arrange
@@ -195,7 +196,7 @@ def test_create_service_empty_key(self):
# test non-string account URL
with pytest.raises(ValueError):
- test_service = service_type(account_url=123456, credential=self.tables_primary_storage_account_key, table_name='foo')
+ test_service = service_type(account_url=123456, credential=self.credential, table_name='foo')
assert str(e.value) == "You need to provide either a SAS token or an account shared key to authenticate."
@@ -205,25 +206,25 @@ def test_create_service_with_socket_timeout(self):
for service_type in SERVICES.items():
# Act
default_service = service_type[0](
- self.account_url(self.tables_storage_account_name, "table"), credential=self.tables_primary_storage_account_key, table_name='foo')
+ self.account_url(self.tables_storage_account_name, "table"), credential=self.credential, table_name='foo')
service = service_type[0](
- self.account_url(self.tables_storage_account_name, "table"), credential=self.tables_primary_storage_account_key,
+ self.account_url(self.tables_storage_account_name, "table"), credential=self.credential,
table_name='foo', connection_timeout=22)
# Assert
self.validate_standard_account_endpoints(service, self.tables_storage_account_name, self.tables_primary_storage_account_key)
assert service._client._client._pipeline._transport.connection_config.timeout == 22
assert default_service._client._client._pipeline._transport.connection_config.timeout == 300
-
+
# Assert Parent transport is shared with child client
service = TableServiceClient(
self.account_url(self.tables_storage_account_name, "table"),
- credential=self.tables_primary_storage_account_key,
+ credential=self.credential,
connection_timeout=22)
assert service._client._client._pipeline._transport.connection_config.timeout == 22
table = service.get_table_client('tablename')
assert table._client._client._pipeline._transport._transport.connection_config.timeout == 22
-
+
# --Connection String Test Cases --------------------------------------------
@@ -237,7 +238,7 @@ def test_create_service_with_connection_string_key(self):
# Assert
self.validate_standard_account_endpoints(service, self.tables_storage_account_name, self.tables_primary_storage_account_key)
- assert service.scheme == 'https'
+ assert service.scheme == 'https'
def test_create_service_with_connection_string_sas(self):
# Arrange
@@ -251,7 +252,7 @@ def test_create_service_with_connection_string_sas(self):
# Assert
assert service is not None
- assert service.account_name == self.tables_storage_account_name
+ assert service.account_name == self.tables_storage_account_name
assert service.url.startswith(
'https://' + self.tables_storage_account_name + '.table.core.windows.net')
assert service.url.endswith(token)
@@ -268,12 +269,12 @@ def test_create_service_with_connection_string_cosmos(self):
# Assert
assert service is not None
- assert service.account_name == self.tables_storage_account_name
+ assert service.account_name == self.tables_storage_account_name
assert service.url.startswith('https://' + self.tables_storage_account_name + '.table.cosmos.azure.com')
- assert service.credential.account_name == self.tables_storage_account_name
- assert service.credential.account_key == self.tables_primary_storage_account_key
+ assert service.credential.named_key.name == self.tables_storage_account_name
+ assert service.credential.named_key.key == self.tables_primary_storage_account_key
assert service._primary_endpoint.startswith('https://' + self.tables_storage_account_name + '.table.cosmos.azure.com')
- assert service.scheme == 'https'
+ assert service.scheme == 'https'
def test_create_service_with_connection_string_endpoint_protocol(self):
# Arrange
@@ -286,11 +287,11 @@ def test_create_service_with_connection_string_endpoint_protocol(self):
# Assert
assert service is not None
- assert service.account_name == self.tables_storage_account_name
- assert service.credential.account_name == self.tables_storage_account_name
- assert service.credential.account_key == self.tables_primary_storage_account_key
+ assert service.account_name == self.tables_storage_account_name
+ assert service.credential.named_key.name == self.tables_storage_account_name
+ assert service.credential.named_key.key == self.tables_primary_storage_account_key
assert service._primary_endpoint.startswith('http://{}.{}.core.chinacloudapi.cn'.format(self.tables_storage_account_name, "table"))
- assert service.scheme == 'http'
+ assert service.scheme == 'http'
def test_create_service_with_connection_string_emulated(self):
# Arrange
@@ -312,9 +313,8 @@ def test_create_service_with_connection_string_custom_domain(self):
# Assert
assert service is not None
- assert service.account_name == self.tables_storage_account_name
- assert service.credential.account_name == self.tables_storage_account_name
- assert service.credential.account_key == self.tables_primary_storage_account_key
+ assert service.credential.named_key.name == self.tables_storage_account_name
+ assert service.credential.named_key.key == self.tables_primary_storage_account_key
assert service._primary_endpoint.startswith('https://www.mydomain.com')
def test_create_service_with_conn_str_custom_domain_trailing_slash(self):
@@ -328,9 +328,8 @@ def test_create_service_with_conn_str_custom_domain_trailing_slash(self):
# Assert
assert service is not None
- assert service.account_name == self.tables_storage_account_name
- assert service.credential.account_name == self.tables_storage_account_name
- assert service.credential.account_key == self.tables_primary_storage_account_key
+ assert service.credential.named_key.name == self.tables_storage_account_name
+ assert service.credential.named_key.key == self.tables_primary_storage_account_key
assert service._primary_endpoint.startswith('https://www.mydomain.com')
def test_create_service_with_conn_str_custom_domain_sec_override(self):
@@ -345,9 +344,8 @@ def test_create_service_with_conn_str_custom_domain_sec_override(self):
# Assert
assert service is not None
- assert service.account_name == self.tables_storage_account_name
- assert service.credential.account_name == self.tables_storage_account_name
- assert service.credential.account_key == self.tables_primary_storage_account_key
+ assert service.credential.named_key.name == self.tables_storage_account_name
+ assert service.credential.named_key.key == self.tables_primary_storage_account_key
assert service._primary_endpoint.startswith('https://www.mydomain.com')
def test_create_service_with_conn_str_fails_if_sec_without_primary(self):
@@ -377,9 +375,8 @@ def test_create_service_with_conn_str_succeeds_if_sec_with_primary(self):
# Assert
assert service is not None
- assert service.account_name == self.tables_storage_account_name
- assert service.credential.account_name == self.tables_storage_account_name
- assert service.credential.account_key == self.tables_primary_storage_account_key
+ assert service.credential.named_key.name == self.tables_storage_account_name
+ assert service.credential.named_key.key == self.tables_primary_storage_account_key
assert service._primary_endpoint.startswith('https://www.mydomain.com')
def test_create_service_with_custom_account_endpoint_path(self):
@@ -393,50 +390,50 @@ def test_create_service_with_custom_account_endpoint_path(self):
service = service_type[0].from_connection_string(conn_string, table_name="foo")
# Assert
- assert service.account_name == self.tables_storage_account_name
- assert service.credential.account_name == self.tables_storage_account_name
- assert service.credential.account_key == self.tables_primary_storage_account_key
- assert service._primary_hostname == 'local-machine:11002/custom/account/path'
+ assert service.account_name == "custom"
+ assert service.credential.named_key.name == self.tables_storage_account_name
+ assert service.credential.named_key.key == self.tables_primary_storage_account_key
+ assert service._primary_hostname == 'local-machine:11002/custom/account/path'
service = TableServiceClient(account_url=custom_account_url)
assert service.account_name == "custom"
- assert service.credential == None
- assert service._primary_hostname == 'local-machine:11002/custom/account/path'
+ assert service.credential == None
+ assert service._primary_hostname == 'local-machine:11002/custom/account/path'
assert service.url.startswith('http://local-machine:11002/custom/account/path')
service = TableClient(account_url=custom_account_url, table_name="foo")
assert service.account_name == "custom"
- assert service.table_name == "foo"
- assert service.credential == None
- assert service._primary_hostname == 'local-machine:11002/custom/account/path'
+ assert service.table_name == "foo"
+ assert service.credential == None
+ assert service._primary_hostname == 'local-machine:11002/custom/account/path'
assert service.url.startswith('http://local-machine:11002/custom/account/path')
service = TableClient.from_table_url("http://local-machine:11002/custom/account/path/foo" + token)
assert service.account_name == "custom"
- assert service.table_name == "foo"
- assert service.credential == None
- assert service._primary_hostname == 'local-machine:11002/custom/account/path'
+ assert service.table_name == "foo"
+ assert service.credential == None
+ assert service._primary_hostname == 'local-machine:11002/custom/account/path'
assert service.url.startswith('http://local-machine:11002/custom/account/path')
def test_create_table_client_with_complete_table_url(self):
# Arrange
table_url = self.account_url(self.tables_storage_account_name, "table") + "/foo"
- service = TableClient(table_url, table_name='bar', credential=self.tables_primary_storage_account_key)
+ service = TableClient(table_url, table_name='bar', credential=self.credential)
# Assert
- assert service.scheme == 'https'
- assert service.table_name == 'bar'
- assert service.account_name == self.tables_storage_account_name
+ assert service.scheme == 'https'
+ assert service.table_name == 'bar'
+ assert service.account_name == self.tables_storage_account_name
def test_create_table_client_with_complete_url(self):
# Arrange
table_url = "https://{}.table.core.windows.net:443/foo".format(self.tables_storage_account_name)
- service = TableClient(account_url=table_url, table_name='bar', credential=self.tables_primary_storage_account_key)
+ service = TableClient(account_url=table_url, table_name='bar', credential=self.credential)
# Assert
- assert service.scheme == 'https'
- assert service.table_name == 'bar'
- assert service.account_name == self.tables_storage_account_name
+ assert service.scheme == 'https'
+ assert service.table_name == 'bar'
+ assert service.account_name == self.tables_storage_account_name
def test_create_table_client_with_invalid_name(self):
# Arrange
@@ -468,7 +465,7 @@ def test_closing_pipeline_client(self):
for client, url in SERVICES.items():
# Act
service = client(
- self.account_url(self.tables_storage_account_name, "table"), credential=self.tables_primary_storage_account_key, table_name='table')
+ self.account_url(self.tables_storage_account_name, "table"), credential=self.credential, table_name='table')
# Assert
with service:
@@ -480,7 +477,7 @@ def test_closing_pipeline_client_simple(self):
for client, url in SERVICES.items():
# Act
service = client(
- self.account_url(self.tables_storage_account_name, "table"), credential=self.tables_primary_storage_account_key, table_name='table')
+ self.account_url(self.tables_storage_account_name, "table"), credential=self.credential, table_name='table')
service.close()
def test_create_service_with_token_and_http(self):
@@ -501,7 +498,7 @@ def test_create_service_with_token(self):
assert service is not None
assert service.account_name == self.tables_storage_account_name
assert service.url.startswith('https://' + self.tables_storage_account_name + suffix)
- assert service.credential == self.token_credential
+ assert service.credential == self.token_credential
assert not hasattr(service.credential, 'account_key')
assert hasattr(service.credential, 'get_token')
@@ -511,21 +508,21 @@ def test_create_service_with_token(self):
assert service is not None
assert service.account_name == self.tables_storage_account_name
assert service.url.startswith('https://' + self.tables_storage_account_name + suffix)
- assert service.credential == self.token_credential
+ assert service.credential == self.token_credential
assert not hasattr(service.credential, 'account_key')
assert hasattr(service.credential, 'get_token')
def test_create_client_with_api_version(self):
url = self.account_url(self.tables_storage_account_name, "table")
- client = TableServiceClient(url, credential=self.tables_primary_storage_account_key)
+ client = TableServiceClient(url, credential=self.credential)
assert client._client._config.version == "2019-02-02"
table = client.get_table_client('tablename')
assert table._client._config.version == "2019-02-02"
- client = TableServiceClient(url, credential=self.tables_primary_storage_account_key, api_version="2019-07-07")
+ client = TableServiceClient(url, credential=self.credential, api_version="2019-07-07")
assert client._client._config.version == "2019-07-07"
table = client.get_table_client('tablename')
assert table._client._config.version == "2019-07-07"
with pytest.raises(ValueError):
- TableServiceClient(url, credential=self.tables_primary_storage_account_key, api_version="foo")
+ TableServiceClient(url, credential=self.credential, api_version="foo")
diff --git a/sdk/tables/azure-data-tables/tests/test_table_client_async.py b/sdk/tables/azure-data-tables/tests/test_table_client_async.py
index f989d2df8a27..ab61bdfb85b0 100644
--- a/sdk/tables/azure-data-tables/tests/test_table_client_async.py
+++ b/sdk/tables/azure-data-tables/tests/test_table_client_async.py
@@ -3,16 +3,18 @@
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
+from azure.core.credentials import AzureNamedKeyCredential
import pytest
import platform
from devtools_testutils import AzureTestCase
+from azure.core.credentials import AzureNamedKeyCredential
from azure.data.tables.aio import TableServiceClient, TableClient
from azure.data.tables._version import VERSION
from _shared.asynctestcase import AsyncTableTestCase
-from preparers import TablesPreparer
+from async_preparers import tables_decorator_async
from devtools_testutils import AzureTestCase
# ------------------------------------------------------------------------------
SERVICES = {
@@ -27,7 +29,7 @@
class TestTableClient(AzureTestCase, AsyncTableTestCase):
- @TablesPreparer()
+ @tables_decorator_async
async def test_user_agent_default_async(self, tables_storage_account_name, tables_primary_storage_account_key):
service = TableServiceClient(self.account_url(tables_storage_account_name, "table"), credential=tables_primary_storage_account_key)
@@ -46,7 +48,7 @@ def callback(response):
async for table in tables:
count += 1
- @TablesPreparer()
+ @tables_decorator_async
async def test_user_agent_custom_async(self, tables_storage_account_name, tables_primary_storage_account_key):
custom_app = "TestApp/v1.0"
service = TableServiceClient(
@@ -82,7 +84,7 @@ def callback(response):
async for table in tables:
count += 1
- @TablesPreparer()
+ @tables_decorator_async
async def test_user_agent_append(self, tables_storage_account_name, tables_primary_storage_account_key):
service = TableServiceClient(self.account_url(tables_storage_account_name, "table"), credential=tables_primary_storage_account_key)
@@ -102,13 +104,14 @@ def callback(response):
class TestTableClientUnit(AsyncTableTestCase):
tables_storage_account_name = "fake_storage_account"
tables_primary_storage_account_key = "fakeXMZjnGsZGvd4bVr3Il5SeHA"
+ credential = AzureNamedKeyCredential(name=tables_storage_account_name, key=tables_primary_storage_account_key)
# --Helpers-----------------------------------------------------------------
def validate_standard_account_endpoints(self, service, account_name, account_key):
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.account_name == account_name
+ assert service.credential.named_key.name == account_name
+ assert service.credential.named_key.key == account_key
assert ('{}.{}'.format(account_name, 'table.core.windows.net') in service.url) or ('{}.{}'.format(account_name, 'table.cosmos.azure.com') in service.url)
# --Direct Parameters Test Cases --------------------------------------------
@@ -119,11 +122,11 @@ async def test_create_service_with_key_async(self):
for client, url in SERVICES.items():
# Act
service = client(
- self.account_url(self.tables_storage_account_name, url), credential=self.tables_primary_storage_account_key, table_name='foo')
+ self.account_url(self.tables_storage_account_name, url), credential=self.credential, table_name='foo')
# Assert
self.validate_standard_account_endpoints(service, self.tables_storage_account_name, self.tables_primary_storage_account_key)
- assert service.scheme == 'https'
+ assert service.scheme == 'https'
@pytest.mark.asyncio
async def test_create_service_with_connection_string_async(self):
@@ -135,7 +138,7 @@ async def test_create_service_with_connection_string_async(self):
# Assert
self.validate_standard_account_endpoints(service, self.tables_storage_account_name, self.tables_primary_storage_account_key)
- assert service.scheme == 'https'
+ assert service.scheme == 'https'
@pytest.mark.asyncio
async def test_create_service_with_sas_async(self):
@@ -150,7 +153,7 @@ async def test_create_service_with_sas_async(self):
# Assert
assert service is not None
- assert service.account_name == self.tables_storage_account_name
+ assert service.account_name == self.tables_storage_account_name
assert service.url.startswith('https://' + self.tables_storage_account_name + suffix)
assert service.url.endswith(token)
assert service.credential is None
@@ -166,7 +169,7 @@ async def test_create_service_with_token_async(self):
# Assert
assert service is not None
- assert service.account_name == self.tables_storage_account_name
+ assert service.account_name == self.tables_storage_account_name
assert service.url.startswith('https://' + self.tables_storage_account_name + suffix)
assert service.credential == self.token_credential
assert not hasattr(service.credential, 'account_key')
@@ -187,13 +190,13 @@ async def test_create_service_china_async(self):
# Act
url = self.account_url(self.tables_storage_account_name, "table").replace('core.windows.net', 'core.chinacloudapi.cn')
service = service_type[0](
- url, credential=self.tables_primary_storage_account_key, table_name='foo')
+ url, credential=self.credential, table_name='foo')
# Assert
assert service is not None
- assert service.account_name == self.tables_storage_account_name
- assert service.credential.account_name == self.tables_storage_account_name
- assert service.credential.account_key == self.tables_primary_storage_account_key
+ assert service.account_name == self.tables_storage_account_name
+ assert service.credential.named_key.name == self.tables_storage_account_name
+ assert service.credential.named_key.key == self.tables_primary_storage_account_key
assert service._primary_endpoint.startswith('https://{}.{}.core.chinacloudapi.cn'.format(self.tables_storage_account_name, "table"))
@pytest.mark.asyncio
@@ -204,11 +207,11 @@ async def test_create_service_protocol_async(self):
# Act
url = self.account_url(self.tables_storage_account_name, "table").replace('https', 'http')
service = service_type[0](
- url, credential=self.tables_primary_storage_account_key, table_name='foo')
+ url, credential=self.credential, table_name='foo')
# Assert
self.validate_standard_account_endpoints(service, self.tables_storage_account_name, self.tables_primary_storage_account_key)
- assert service.scheme == 'http'
+ assert service.scheme == 'http'
@pytest.mark.asyncio
async def test_create_service_empty_key_async(self):
@@ -229,9 +232,9 @@ async def test_create_service_with_socket_timeout_async(self):
for service_type in SERVICES.items():
# Act
default_service = service_type[0](
- self.account_url(self.tables_storage_account_name, "table"), credential=self.tables_primary_storage_account_key, table_name='foo')
+ self.account_url(self.tables_storage_account_name, "table"), credential=self.credential, table_name='foo')
service = service_type[0](
- self.account_url(self.tables_storage_account_name, "table"), credential=self.tables_primary_storage_account_key,
+ self.account_url(self.tables_storage_account_name, "table"), credential=self.credential,
table_name='foo', connection_timeout=22)
# Assert
@@ -242,7 +245,7 @@ async def test_create_service_with_socket_timeout_async(self):
# Assert Parent transport is shared with child client
service = TableServiceClient(
self.account_url(self.tables_storage_account_name, "table"),
- credential=self.tables_primary_storage_account_key,
+ credential=self.credential,
connection_timeout=22)
assert service._client._client._pipeline._transport.connection_config.timeout == 22
table = service.get_table_client('tablename')
@@ -260,7 +263,7 @@ async def test_create_service_with_connection_string_key_async(self):
# Assert
self.validate_standard_account_endpoints(service, self.tables_storage_account_name, self.tables_primary_storage_account_key)
- assert service.scheme == 'https'
+ assert service.scheme == 'https'
@pytest.mark.asyncio
async def test_create_service_with_connection_string_sas_async(self):
@@ -274,7 +277,7 @@ async def test_create_service_with_connection_string_sas_async(self):
# Assert
assert service is not None
- assert service.account_name == self.tables_storage_account_name
+ assert service.account_name == self.tables_storage_account_name
assert service.url.startswith('https://' + self.tables_storage_account_name + '.table.core.windows.net')
assert service.url.endswith(token)
assert service.credential is None
@@ -291,12 +294,11 @@ async def test_create_service_with_connection_string_cosmos_async(self):
# Assert
assert service is not None
- assert service.account_name == self.tables_storage_account_name
assert service.url.startswith('https://' + self.tables_storage_account_name + '.table.cosmos.azure.com')
- assert service.credential.account_name == self.tables_storage_account_name
- assert service.credential.account_key == self.tables_primary_storage_account_key
+ assert service.credential.named_key.name == self.tables_storage_account_name
+ assert service.credential.named_key.key == self.tables_primary_storage_account_key
assert service._primary_endpoint.startswith('https://' + self.tables_storage_account_name + '.table.cosmos.azure.com')
- assert service.scheme == 'https'
+ assert service.scheme == 'https'
@pytest.mark.asyncio
async def test_create_service_with_connection_string_endpoint_protocol_async(self):
@@ -310,11 +312,10 @@ async def test_create_service_with_connection_string_endpoint_protocol_async(sel
# Assert
assert service is not None
- assert service.account_name == self.tables_storage_account_name
- assert service.credential.account_name == self.tables_storage_account_name
- assert service.credential.account_key == self.tables_primary_storage_account_key
+ assert service.credential.named_key.name == self.tables_storage_account_name
+ assert service.credential.named_key.key == self.tables_primary_storage_account_key
assert service._primary_endpoint.startswith('http://{}.{}.core.chinacloudapi.cn'.format(self.tables_storage_account_name, "table"))
- assert service.scheme == 'http'
+ assert service.scheme == 'http'
@pytest.mark.asyncio
async def test_create_service_with_connection_string_emulated_async(self):
@@ -338,9 +339,8 @@ async def test_create_service_with_connection_string_custom_domain_async(self):
# Assert
assert service is not None
- assert service.account_name == self.tables_storage_account_name
- assert service.credential.account_name == self.tables_storage_account_name
- assert service.credential.account_key == self.tables_primary_storage_account_key
+ assert service.credential.named_key.name == self.tables_storage_account_name
+ assert service.credential.named_key.key == self.tables_primary_storage_account_key
assert service._primary_endpoint.startswith('https://www.mydomain.com')
@pytest.mark.asyncio
@@ -355,9 +355,8 @@ async def test_create_service_with_conn_str_custom_domain_trailing_slash_async(s
# Assert
assert service is not None
- assert service.account_name == self.tables_storage_account_name
- assert service.credential.account_name == self.tables_storage_account_name
- assert service.credential.account_key == self.tables_primary_storage_account_key
+ assert service.credential.named_key.name == self.tables_storage_account_name
+ assert service.credential.named_key.key == self.tables_primary_storage_account_key
assert service._primary_endpoint.startswith('https://www.mydomain.com')
@pytest.mark.asyncio
@@ -373,9 +372,8 @@ async def test_create_service_with_conn_str_custom_domain_sec_override_async(sel
# Assert
assert service is not None
- assert service.account_name == self.tables_storage_account_name
- assert service.credential.account_name == self.tables_storage_account_name
- assert service.credential.account_key == self.tables_primary_storage_account_key
+ assert service.credential.named_key.name == self.tables_storage_account_name
+ assert service.credential.named_key.key == self.tables_primary_storage_account_key
assert service._primary_endpoint.startswith('https://www.mydomain.com')
@pytest.mark.asyncio
@@ -405,9 +403,8 @@ async def test_create_service_with_conn_str_succeeds_if_sec_with_primary_async(s
# Assert
assert service is not None
- assert service.account_name == self.tables_storage_account_name
- assert service.credential.account_name == self.tables_storage_account_name
- assert service.credential.account_key == self.tables_primary_storage_account_key
+ assert service.credential.named_key.name == self.tables_storage_account_name
+ assert service.credential.named_key.key == self.tables_primary_storage_account_key
assert service._primary_endpoint.startswith('https://www.mydomain.com')
@pytest.mark.asyncio
@@ -422,52 +419,52 @@ async def test_create_service_with_custom_account_endpoint_path_async(self):
service = service_type[0].from_connection_string(conn_string, table_name="foo")
# Assert
- assert service.account_name == self.tables_storage_account_name
- assert service.credential.account_name == self.tables_storage_account_name
- assert service.credential.account_key == self.tables_primary_storage_account_key
- assert service._primary_hostname == 'local-machine:11002/custom/account/path'
+ assert service.account_name == "custom"
+ assert service.credential.named_key.name == self.tables_storage_account_name
+ assert service.credential.named_key.key == self.tables_primary_storage_account_key
+ assert service._primary_hostname == 'local-machine:11002/custom/account/path'
service = TableServiceClient(account_url=custom_account_url)
assert service.account_name == "custom"
- assert service.credential == None
- assert service._primary_hostname == 'local-machine:11002/custom/account/path'
+ assert service.credential == None
+ assert service._primary_hostname == 'local-machine:11002/custom/account/path'
assert service.url.startswith('http://local-machine:11002/custom/account/path')
service = TableClient(account_url=custom_account_url, table_name="foo")
assert service.account_name == "custom"
- assert service.table_name == "foo"
- assert service.credential == None
- assert service._primary_hostname == 'local-machine:11002/custom/account/path'
+ assert service.table_name == "foo"
+ assert service.credential == None
+ assert service._primary_hostname == 'local-machine:11002/custom/account/path'
assert service.url.startswith('http://local-machine:11002/custom/account/path')
service = TableClient.from_table_url("http://local-machine:11002/custom/account/path/foo" + token)
assert service.account_name == "custom"
- assert service.table_name == "foo"
- assert service.credential == None
- assert service._primary_hostname == 'local-machine:11002/custom/account/path'
+ assert service.table_name == "foo"
+ assert service.credential == None
+ assert service._primary_hostname == 'local-machine:11002/custom/account/path'
assert service.url.startswith('http://local-machine:11002/custom/account/path')
@pytest.mark.asyncio
async def test_create_table_client_with_complete_table_url_async(self):
# Arrange
table_url = self.account_url(self.tables_storage_account_name, "table") + "/foo"
- service = TableClient(table_url, table_name='bar', credential=self.tables_primary_storage_account_key)
+ service = TableClient(table_url, table_name='bar', credential=self.credential)
# Assert
- assert service.scheme == 'https'
- assert service.table_name == 'bar'
- assert service.account_name == self.tables_storage_account_name
+ assert service.scheme == 'https'
+ assert service.table_name == 'bar'
+ assert service.account_name == self.tables_storage_account_name
@pytest.mark.asyncio
async def test_create_table_client_with_complete_url_async(self):
# Arrange
table_url = "https://{}.table.core.windows.net:443/foo".format(self.tables_storage_account_name)
- service = TableClient(account_url=table_url, table_name='bar', credential=self.tables_primary_storage_account_key)
+ service = TableClient(account_url=table_url, table_name='bar', credential=self.credential)
# Assert
- assert service.scheme == 'https'
- assert service.table_name == 'bar'
- assert service.account_name == self.tables_storage_account_name
+ assert service.scheme == 'https'
+ assert service.table_name == 'bar'
+ assert service.account_name == self.tables_storage_account_name
@pytest.mark.asyncio
async def test_create_table_client_with_invalid_name_async(self):
@@ -502,7 +499,7 @@ async def test_closing_pipeline_client_async(self):
for client, url in SERVICES.items():
# Act
service = client(
- self.account_url(self.tables_storage_account_name, "table"), credential=self.tables_primary_storage_account_key, table_name='table')
+ self.account_url(self.tables_storage_account_name, "table"), credential=self.credential, table_name='table')
# Assert
async with service:
@@ -515,21 +512,21 @@ async def test_closing_pipeline_client_simple_async(self):
for client, url in SERVICES.items():
# Act
service = client(
- self.account_url(self.tables_storage_account_name, "table"), credential=self.tables_primary_storage_account_key, table_name='table')
+ self.account_url(self.tables_storage_account_name, "table"), credential=self.credential, table_name='table')
await service.close()
@pytest.mark.asyncio
async def test_create_client_with_api_version(self):
url = self.account_url(self.tables_storage_account_name, "table")
- client = TableServiceClient(url, credential=self.tables_primary_storage_account_key)
+ client = TableServiceClient(url, credential=self.credential)
assert client._client._config.version == "2019-02-02"
table = client.get_table_client('tablename')
assert table._client._config.version == "2019-02-02"
- client = TableServiceClient(url, credential=self.tables_primary_storage_account_key, api_version="2019-07-07")
+ client = TableServiceClient(url, credential=self.credential, api_version="2019-07-07")
assert client._client._config.version == "2019-07-07"
table = client.get_table_client('tablename')
assert table._client._config.version == "2019-07-07"
with pytest.raises(ValueError):
- TableServiceClient(url, credential=self.tables_primary_storage_account_key, api_version="foo")
\ No newline at end of file
+ TableServiceClient(url, credential=self.credential, api_version="foo")
\ No newline at end of file
diff --git a/sdk/tables/azure-data-tables/tests/test_table_client_cosmos.py b/sdk/tables/azure-data-tables/tests/test_table_client_cosmos.py
index 8d8da85ef85c..2cb2787da0c3 100644
--- a/sdk/tables/azure-data-tables/tests/test_table_client_cosmos.py
+++ b/sdk/tables/azure-data-tables/tests/test_table_client_cosmos.py
@@ -12,12 +12,13 @@
from azure.data.tables import TableServiceClient, TableClient
from azure.data.tables import __version__ as VERSION
+from azure.core.credentials import AzureNamedKeyCredential
from _shared.testcase import (
TableTestCase,
SLEEP_DELAY
)
-from preparers import CosmosPreparer
+from preparers import cosmos_decorator
# ------------------------------------------------------------------------------
SERVICES = {
@@ -32,7 +33,7 @@
class TestTableClient(AzureTestCase, TableTestCase):
@pytest.mark.skipif(sys.version_info < (3, 0), reason="Malformed string")
- @CosmosPreparer()
+ @cosmos_decorator
def test_user_agent_default(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
service = TableServiceClient(self.account_url(tables_cosmos_account_name, "cosmos"), credential=tables_primary_cosmos_account_key)
@@ -54,7 +55,7 @@ def callback(response):
sleep(SLEEP_DELAY)
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @CosmosPreparer()
+ @cosmos_decorator
def test_user_agent_custom(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
custom_app = "TestApp/v1.0"
service = TableServiceClient(
@@ -94,7 +95,7 @@ def callback(response):
sleep(SLEEP_DELAY)
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires Python3")
- @CosmosPreparer()
+ @cosmos_decorator
def test_user_agent_append(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
service = self.create_client_from_credential(
TableServiceClient,
@@ -120,13 +121,14 @@ def callback(response):
class TestTableClientUnit(TableTestCase):
tables_cosmos_account_name = "fake_storage_account"
tables_primary_cosmos_account_key = "fakeXMZjnGsZGvd4bVr3Il5SeHA"
+ credential = AzureNamedKeyCredential(name=tables_cosmos_account_name, key=tables_primary_cosmos_account_key)
# --Helpers-----------------------------------------------------------------
def validate_standard_account_endpoints(self, service, account_name, account_key):
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.named_key.name == account_name
+ assert service.credential.named_key.key == account_key
assert ('{}.{}'.format(account_name, 'table.core.windows.net') in service.url) or ('{}.{}'.format(account_name, 'table.cosmos.azure.com') in service.url)
def _account_url(self, account_name):
@@ -140,21 +142,20 @@ def test_create_service_with_key(self):
# Act
service = client(
account_url=self._account_url(self.tables_cosmos_account_name),
- credential=self.tables_primary_cosmos_account_key,
+ credential=self.credential,
table_name='foo')
# Assert
self.validate_standard_account_endpoints(service, self.tables_cosmos_account_name, self.tables_primary_cosmos_account_key)
assert service.scheme == 'https'
-
def test_create_service_with_connection_string(self):
for client, url in SERVICES.items():
# Act
service = client(
account_url=self._account_url(self.tables_cosmos_account_name),
- credential=self.tables_primary_cosmos_account_key,
+ credential=self.credential,
table_name="test")
# Assert
@@ -187,7 +188,7 @@ def test_create_service_with_token(self):
# Act
service = service_type(
account_url=self._account_url(self.tables_cosmos_account_name),
- credential=self.tables_primary_cosmos_account_key,
+ credential=self.credential,
table_name="foo")
# Assert
@@ -212,12 +213,12 @@ def test_create_service_china(self):
for service_type in SERVICES.items():
url = self.account_url(self.tables_cosmos_account_name, "cosmos").replace('cosmos.azure.com', 'core.chinacloudapi.cn')
service = service_type[0](
- url, credential=self.tables_primary_cosmos_account_key, table_name='foo')
+ url, credential=self.credential, table_name='foo')
assert service is not None
assert service.account_name == self.tables_cosmos_account_name
- assert service.credential.account_name == self.tables_cosmos_account_name
- assert service.credential.account_key == self.tables_primary_cosmos_account_key
+ assert service.credential.named_key.name == self.tables_cosmos_account_name
+ assert service.credential.named_key.key == self.tables_primary_cosmos_account_key
assert service._primary_endpoint.startswith('https://{}.{}.core.chinacloudapi.cn'.format(self.tables_cosmos_account_name, "table"))
def test_create_service_protocol(self):
@@ -228,7 +229,7 @@ def test_create_service_protocol(self):
# Act
service = service_type(
account_url=url,
- credential=self.tables_primary_cosmos_account_key,
+ credential=self.credential,
table_name="foo")
# Assert
@@ -253,11 +254,11 @@ def test_create_service_with_socket_timeout(self):
# Act
default_service = service_type[0](
account_url=self._account_url(self.tables_cosmos_account_name),
- credential=self.tables_primary_cosmos_account_key,
+ credential=self.credential,
table_name="foo")
service = service_type[0](
account_url=self._account_url(self.tables_cosmos_account_name),
- credential=self.tables_primary_cosmos_account_key,
+ credential=self.credential,
table_name="foo", connection_timeout=22)
# Assert
@@ -309,8 +310,8 @@ def test_create_service_with_connection_string_cosmos(self):
assert service is not None
assert service.account_name == self.tables_cosmos_account_name
assert service.url.startswith('https://' + self.tables_cosmos_account_name + '.table.cosmos.azure.com')
- assert service.credential.account_name == self.tables_cosmos_account_name
- assert service.credential.account_key == self.tables_primary_cosmos_account_key
+ assert service.credential.named_key.name == self.tables_cosmos_account_name
+ assert service.credential.named_key.key == self.tables_primary_cosmos_account_key
assert service._primary_endpoint.startswith('https://' + self.tables_cosmos_account_name + '.table.cosmos.azure.com')
assert service.scheme == 'https'
@@ -323,8 +324,8 @@ def test_create_service_with_connection_string_endpoint_protocol(self):
assert service is not None
assert service.account_name == self.tables_cosmos_account_name
- assert service.credential.account_name == self.tables_cosmos_account_name
- assert service.credential.account_key == self.tables_primary_cosmos_account_key
+ assert service.credential.named_key.name == self.tables_cosmos_account_name
+ assert service.credential.named_key.key == self.tables_primary_cosmos_account_key
assert service._primary_endpoint.startswith('http://{}.{}.core.chinacloudapi.cn'.format(self.tables_cosmos_account_name, "table"))
assert service.scheme == 'http'
@@ -350,9 +351,8 @@ def test_create_service_with_connection_string_custom_domain(self):
# Assert
assert service is not None
- assert service.account_name == self.tables_cosmos_account_name
- assert service.credential.account_name == self.tables_cosmos_account_name
- assert service.credential.account_key == self.tables_primary_cosmos_account_key
+ assert service.credential.named_key.name == self.tables_cosmos_account_name
+ assert service.credential.named_key.key == self.tables_primary_cosmos_account_key
assert service._primary_endpoint.startswith('https://www.mydomain.com')
@@ -367,9 +367,8 @@ def test_create_service_with_conn_str_custom_domain_trailing_slash(self):
# Assert
assert service is not None
- assert service.account_name == self.tables_cosmos_account_name
- assert service.credential.account_name == self.tables_cosmos_account_name
- assert service.credential.account_key == self.tables_primary_cosmos_account_key
+ assert service.credential.named_key.name == self.tables_cosmos_account_name
+ assert service.credential.named_key.key == self.tables_primary_cosmos_account_key
assert service._primary_endpoint.startswith('https://www.mydomain.com')
def test_create_service_with_conn_str_custom_domain_sec_override(self):
@@ -384,9 +383,8 @@ def test_create_service_with_conn_str_custom_domain_sec_override(self):
# Assert
assert service is not None
- assert service.account_name == self.tables_cosmos_account_name
- assert service.credential.account_name == self.tables_cosmos_account_name
- assert service.credential.account_key == self.tables_primary_cosmos_account_key
+ assert service.credential.named_key.name == self.tables_cosmos_account_name
+ assert service.credential.named_key.key == self.tables_primary_cosmos_account_key
assert service._primary_endpoint.startswith('https://www.mydomain.com')
def test_create_service_with_conn_str_fails_if_sec_without_primary(self):
@@ -417,9 +415,8 @@ def test_create_service_with_conn_str_succeeds_if_sec_with_primary(self):
# Assert
assert service is not None
- assert service.account_name == self.tables_cosmos_account_name
- assert service.credential.account_name == self.tables_cosmos_account_name
- assert service.credential.account_key == self.tables_primary_cosmos_account_key
+ assert service.credential.named_key.name == self.tables_cosmos_account_name
+ assert service.credential.named_key.key == self.tables_primary_cosmos_account_key
assert service._primary_endpoint.startswith('https://www.mydomain.com')
def test_create_service_with_custom_account_endpoint_path(self):
@@ -433,9 +430,9 @@ def test_create_service_with_custom_account_endpoint_path(self):
service = service_type[0].from_connection_string(conn_string, table_name="foo")
# Assert
- assert service.account_name == self.tables_cosmos_account_name
- assert service.credential.account_name == self.tables_cosmos_account_name
- assert service.credential.account_key == self.tables_primary_cosmos_account_key
+ assert service.account_name == "custom"
+ assert service.credential.named_key.name == self.tables_cosmos_account_name
+ assert service.credential.named_key.key == self.tables_primary_cosmos_account_key
assert service._primary_hostname == 'local-machine:11002/custom/account/path'
service = TableServiceClient(account_url=custom_account_url)
@@ -464,7 +461,7 @@ def test_create_table_client_with_complete_table_url(self):
table_url = self._account_url(self.tables_cosmos_account_name) + "/foo"
service = TableClient(
account_url=table_url,
- credential=self.tables_primary_cosmos_account_key,
+ credential=self.credential,
table_name="bar")
# Assert
@@ -478,7 +475,7 @@ def test_create_table_client_with_complete_url(self):
table_url = "https://{}.table.cosmos.azure.com:443/foo".format(self.tables_cosmos_account_name)
service = TableClient(
account_url=table_url,
- credential=self.tables_primary_cosmos_account_key,
+ credential=self.credential,
table_name="bar")
# Assert
@@ -517,7 +514,7 @@ def test_closing_pipeline_client(self):
# Act
service = client(
account_url=self._account_url(self.tables_cosmos_account_name),
- credential=self.tables_primary_cosmos_account_key,
+ credential=self.credential,
table_name='table')
# Assert
@@ -532,7 +529,7 @@ def test_closing_pipeline_client_simple(self):
# Act
service = client(
account_url=self._account_url(self.tables_cosmos_account_name),
- credential=self.tables_primary_cosmos_account_key,
+ credential=self.credential,
table_name='table')
service.close()
diff --git a/sdk/tables/azure-data-tables/tests/test_table_client_cosmos_async.py b/sdk/tables/azure-data-tables/tests/test_table_client_cosmos_async.py
index 8952b69490f7..66f6b4c81723 100644
--- a/sdk/tables/azure-data-tables/tests/test_table_client_cosmos_async.py
+++ b/sdk/tables/azure-data-tables/tests/test_table_client_cosmos_async.py
@@ -3,6 +3,7 @@
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
+from azure.core.credentials import AzureNamedKeyCredential
import pytest
import platform
from time import sleep
@@ -14,7 +15,7 @@
from _shared.asynctestcase import AsyncTableTestCase
from _shared.testcase import SLEEP_DELAY
-from preparers import CosmosPreparer
+from async_preparers import cosmos_decorator_async
from devtools_testutils import AzureTestCase
# ------------------------------------------------------------------------------
@@ -30,7 +31,7 @@
class TestTableClient(AzureTestCase, AsyncTableTestCase):
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_user_agent_default_async(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
service = TableServiceClient(self.account_url(tables_cosmos_account_name, "cosmos"), credential=tables_primary_cosmos_account_key)
@@ -52,7 +53,7 @@ def callback(response):
if self.is_live:
sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_user_agent_custom_async(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
custom_app = "TestApp/v1.0"
service = TableServiceClient(
@@ -88,7 +89,7 @@ def callback(response):
if self.is_live:
sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_user_agent_append(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
service = TableServiceClient(self.account_url(tables_cosmos_account_name, "cosmos"), credential=tables_primary_cosmos_account_key)
@@ -111,13 +112,14 @@ def callback(response):
class TestTableClientUnit(AsyncTableTestCase):
tables_cosmos_account_name = "fake_storage_account"
tables_primary_cosmos_account_key = "fakeXMZjnGsZGvd4bVr3Il5SeHA"
+ credential = AzureNamedKeyCredential(name=tables_cosmos_account_name, key=tables_primary_cosmos_account_key)
# --Helpers-----------------------------------------------------------------
def validate_standard_account_endpoints(self, service, account_name, account_key):
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.named_key.name == account_name
+ assert service.credential.named_key.key == account_key
assert '{}.{}'.format(account_name, 'table.core.windows.net') in service.url or '{}.{}'.format(account_name, 'table.cosmos.azure.com') in service.url
# --Direct Parameters Test Cases --------------------------------------------
@@ -128,7 +130,7 @@ async def test_create_service_with_key_async(self):
for client, url in SERVICES.items():
# Act
service = client(
- self.account_url(self.tables_cosmos_account_name, url), credential=self.tables_primary_cosmos_account_key, table_name='foo')
+ self.account_url(self.tables_cosmos_account_name, url), credential=self.credential, table_name='foo')
# Assert
self.validate_standard_account_endpoints(service, self.tables_cosmos_account_name, self.tables_primary_cosmos_account_key)
@@ -197,14 +199,13 @@ async def test_create_service_china_async(self):
for service_type in SERVICES.items():
# Act
url = self.account_url(self.tables_cosmos_account_name, "cosmos").replace('cosmos.azure.com', 'core.chinacloudapi.cn')
- service = service_type[0](
- url, credential=self.tables_primary_cosmos_account_key, table_name='foo')
+ service = service_type[0](url, credential=self.credential, table_name='foo')
# Assert
assert service is not None
assert service.account_name == self.tables_cosmos_account_name
- assert service.credential.account_name == self.tables_cosmos_account_name
- assert service.credential.account_key == self.tables_primary_cosmos_account_key
+ assert service.credential.named_key.name == self.tables_cosmos_account_name
+ assert service.credential.named_key.key == self.tables_primary_cosmos_account_key
assert service._primary_endpoint.startswith('https://{}.{}.core.chinacloudapi.cn'.format(self.tables_cosmos_account_name, "table"))
@pytest.mark.asyncio
@@ -215,7 +216,7 @@ async def test_create_service_protocol_async(self):
# Act
url = self.account_url(self.tables_cosmos_account_name, "cosmos").replace('https', 'http')
service = service_type[0](
- url, credential=self.tables_primary_cosmos_account_key, table_name='foo')
+ url, credential=self.credential, table_name='foo')
# Assert
self.validate_standard_account_endpoints(service, self.tables_cosmos_account_name, self.tables_primary_cosmos_account_key)
@@ -240,9 +241,9 @@ async def test_create_service_with_socket_timeout_async(self):
for service_type in SERVICES.items():
# Act
default_service = service_type[0](
- self.account_url(self.tables_cosmos_account_name, "cosmos"), credential=self.tables_primary_cosmos_account_key, table_name='foo')
+ self.account_url(self.tables_cosmos_account_name, "cosmos"), credential=self.credential, table_name='foo')
service = service_type[0](
- self.account_url(self.tables_cosmos_account_name, "cosmos"), credential=self.tables_primary_cosmos_account_key,
+ self.account_url(self.tables_cosmos_account_name, "cosmos"), credential=self.credential,
table_name='foo', connection_timeout=22)
# Assert
@@ -295,8 +296,8 @@ async def test_create_service_with_connection_string_cosmos_async(self):
assert service is not None
assert service.account_name == self.tables_cosmos_account_name
assert service.url.startswith('https://' + self.tables_cosmos_account_name + '.table.cosmos.azure.com')
- assert service.credential.account_name == self.tables_cosmos_account_name
- assert service.credential.account_key == self.tables_primary_cosmos_account_key
+ assert service.credential.named_key.name == self.tables_cosmos_account_name
+ assert service.credential.named_key.key == self.tables_primary_cosmos_account_key
assert service._primary_endpoint.startswith('https://' + self.tables_cosmos_account_name + '.table.cosmos.azure.com')
assert service.scheme == 'https'
@@ -313,8 +314,8 @@ async def test_create_service_with_connection_string_endpoint_protocol_async(sel
# Assert
assert service is not None
assert service.account_name == self.tables_cosmos_account_name
- assert service.credential.account_name == self.tables_cosmos_account_name
- assert service.credential.account_key == self.tables_primary_cosmos_account_key
+ assert service.credential.named_key.name == self.tables_cosmos_account_name
+ assert service.credential.named_key.key == self.tables_primary_cosmos_account_key
assert service._primary_endpoint.startswith('http://{}.{}.core.chinacloudapi.cn'.format(self.tables_cosmos_account_name, "table"))
assert service.scheme == 'http'
@@ -340,9 +341,8 @@ async def test_create_service_with_connection_string_custom_domain_async(self):
# Assert
assert service is not None
- assert service.account_name == self.tables_cosmos_account_name
- assert service.credential.account_name == self.tables_cosmos_account_name
- assert service.credential.account_key == self.tables_primary_cosmos_account_key
+ assert service.credential.named_key.name == self.tables_cosmos_account_name
+ assert service.credential.named_key.key == self.tables_primary_cosmos_account_key
assert service._primary_endpoint.startswith('https://www.mydomain.com')
@pytest.mark.asyncio
@@ -357,9 +357,8 @@ async def test_create_service_with_conn_str_custom_domain_trailing_slash_async(s
# Assert
assert service is not None
- assert service.account_name == self.tables_cosmos_account_name
- assert service.credential.account_name == self.tables_cosmos_account_name
- assert service.credential.account_key == self.tables_primary_cosmos_account_key
+ assert service.credential.named_key.name == self.tables_cosmos_account_name
+ assert service.credential.named_key.key == self.tables_primary_cosmos_account_key
assert service._primary_endpoint.startswith('https://www.mydomain.com')
@pytest.mark.asyncio
@@ -375,9 +374,8 @@ async def test_create_service_with_conn_str_custom_domain_sec_override_async(sel
# Assert
assert service is not None
- assert service.account_name == self.tables_cosmos_account_name
- assert service.credential.account_name == self.tables_cosmos_account_name
- assert service.credential.account_key == self.tables_primary_cosmos_account_key
+ assert service.credential.named_key.name == self.tables_cosmos_account_name
+ assert service.credential.named_key.key == self.tables_primary_cosmos_account_key
assert service._primary_endpoint.startswith('https://www.mydomain.com')
@pytest.mark.asyncio
@@ -407,9 +405,8 @@ async def test_create_service_with_conn_str_succeeds_if_sec_with_primary_async(s
# Assert
assert service is not None
- assert service.account_name == self.tables_cosmos_account_name
- assert service.credential.account_name == self.tables_cosmos_account_name
- assert service.credential.account_key == self.tables_primary_cosmos_account_key
+ assert service.credential.named_key.name == self.tables_cosmos_account_name
+ assert service.credential.named_key.key == self.tables_primary_cosmos_account_key
assert service._primary_endpoint.startswith('https://www.mydomain.com')
@pytest.mark.asyncio
@@ -424,9 +421,9 @@ async def test_create_service_with_custom_account_endpoint_path_async(self):
service = service_type[0].from_connection_string(conn_string, table_name="foo")
# Assert
- assert service.account_name == self.tables_cosmos_account_name
- assert service.credential.account_name == self.tables_cosmos_account_name
- assert service.credential.account_key == self.tables_primary_cosmos_account_key
+ assert service.account_name == "custom"
+ assert service.credential.named_key.name == self.tables_cosmos_account_name
+ assert service.credential.named_key.key == self.tables_primary_cosmos_account_key
assert service._primary_hostname == 'local-machine:11002/custom/account/path'
service = TableServiceClient(account_url=custom_account_url)
@@ -454,7 +451,7 @@ async def test_create_service_with_custom_account_endpoint_path_async(self):
async def test_create_table_client_with_complete_table_url_async(self):
# Arrange
table_url = self.account_url(self.tables_cosmos_account_name, "cosmos") + "/foo"
- service = TableClient(table_url, table_name='bar', credential=self.tables_primary_cosmos_account_key)
+ service = TableClient(table_url, table_name='bar', credential=self.credential)
# Assert
assert service.scheme == 'https'
@@ -465,7 +462,7 @@ async def test_create_table_client_with_complete_table_url_async(self):
async def test_create_table_client_with_complete_url_async(self):
# Arrange
table_url = "https://{}.table.cosmos.azure.com:443/foo".format(self.tables_cosmos_account_name)
- service = TableClient(table_url, table_name='bar', credential=self.tables_primary_cosmos_account_key)
+ service = TableClient(table_url, table_name='bar', credential=self.credential)
# Assert
assert service.scheme == 'https'
@@ -505,7 +502,7 @@ async def test_closing_pipeline_client_async(self):
for client, url in SERVICES.items():
# Act
service = client(
- self.account_url(self.tables_cosmos_account_name, "cosmos"), credential=self.tables_primary_cosmos_account_key, table_name='table')
+ self.account_url(self.tables_cosmos_account_name, "cosmos"), credential=self.credential, table_name='table')
# Assert
async with service:
@@ -518,5 +515,5 @@ async def test_closing_pipeline_client_simple_async(self):
for client, url in SERVICES.items():
# Act
service = client(
- self.account_url(self.tables_cosmos_account_name, "cosmos"), credential=self.tables_primary_cosmos_account_key, table_name='table')
+ self.account_url(self.tables_cosmos_account_name, "cosmos"), credential=self.credential, table_name='table')
await service.close()
diff --git a/sdk/tables/azure-data-tables/tests/test_table_cosmos.py b/sdk/tables/azure-data-tables/tests/test_table_cosmos.py
index ff8abed741c2..66a73027d1d0 100644
--- a/sdk/tables/azure-data-tables/tests/test_table_cosmos.py
+++ b/sdk/tables/azure-data-tables/tests/test_table_cosmos.py
@@ -17,7 +17,7 @@
from devtools_testutils import AzureTestCase
-from azure.core.credentials import AzureSasCredential
+from azure.core.credentials import AzureNamedKeyCredential
from azure.core.exceptions import (
HttpResponseError,
ResourceNotFoundError,
@@ -44,7 +44,7 @@
)
from _shared.testcase import TableTestCase, SLEEP_DELAY
-from preparers import CosmosPreparer
+from preparers import cosmos_decorator
# ------------------------------------------------------------------------------
TEST_TABLE_PREFIX = 'pytablesync'
@@ -84,7 +84,7 @@ def _delete_all_tables(self, ts):
pass
# --Test cases for tables --------------------------------------------------
- @CosmosPreparer()
+ @cosmos_decorator
def test_create_table(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# # Arrange
ts = TableServiceClient(self.account_url(tables_cosmos_account_name, "cosmos"), tables_primary_cosmos_account_key)
@@ -101,7 +101,7 @@ def test_create_table(self, tables_cosmos_account_name, tables_primary_cosmos_ac
if self.is_live:
sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_create_table_fail_on_exist(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
ts = TableServiceClient(self.account_url(tables_cosmos_account_name, "cosmos"), tables_primary_cosmos_account_key)
@@ -119,7 +119,7 @@ def test_create_table_fail_on_exist(self, tables_cosmos_account_name, tables_pri
if self.is_live:
sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_query_tables_per_page(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
ts = TableServiceClient(self.account_url(tables_cosmos_account_name, "cosmos"), tables_primary_cosmos_account_key)
@@ -150,7 +150,7 @@ def test_query_tables_per_page(self, tables_cosmos_account_name, tables_primary_
sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_query_tables(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
ts = TableServiceClient(self.account_url(tables_cosmos_account_name, "cosmos"), tables_primary_cosmos_account_key)
@@ -168,7 +168,7 @@ def test_query_tables(self, tables_cosmos_account_name, tables_primary_cosmos_ac
if self.is_live:
sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_query_tables_with_filter(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
ts = TableServiceClient(self.account_url(tables_cosmos_account_name, "cosmos"), tables_primary_cosmos_account_key)
@@ -188,7 +188,7 @@ def test_query_tables_with_filter(self, tables_cosmos_account_name, tables_prima
if self.is_live:
sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_query_tables_with_num_results(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
prefix = 'listtable'
@@ -216,7 +216,7 @@ def test_query_tables_with_num_results(self, tables_cosmos_account_name, tables_
if self.is_live:
sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_query_tables_with_marker(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
ts = TableServiceClient(self.account_url(tables_cosmos_account_name, "cosmos"), tables_primary_cosmos_account_key)
@@ -247,7 +247,7 @@ def test_query_tables_with_marker(self, tables_cosmos_account_name, tables_prima
if self.is_live:
sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_delete_table_with_existing_table(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
ts = TableServiceClient(self.account_url(tables_cosmos_account_name, "cosmos"), tables_primary_cosmos_account_key)
@@ -263,7 +263,7 @@ def test_delete_table_with_existing_table(self, tables_cosmos_account_name, tabl
if self.is_live:
sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_delete_table_with_non_existing_table_fail_not_exist(self, tables_cosmos_account_name,
tables_primary_cosmos_account_key):
# Arrange
@@ -281,10 +281,11 @@ def test_delete_table_with_non_existing_table_fail_not_exist(self, tables_cosmos
class TestTableUnitTest(TableTestCase):
tables_cosmos_account_name = "fake_storage_account"
tables_primary_cosmos_account_key = "fakeXMZjnGsZGvd4bVr3Il5SeHA"
+ credential = AzureNamedKeyCredential(name=tables_cosmos_account_name, key=tables_primary_cosmos_account_key)
def test_create_table_invalid_name(self):
# Arrange
- ts = TableServiceClient(self.account_url(self.tables_cosmos_account_name, "cosmos"), self.tables_primary_cosmos_account_key)
+ ts = TableServiceClient(self.account_url(self.tables_cosmos_account_name, "cosmos"), self.credential)
invalid_table_name = "my_table"
with pytest.raises(ValueError) as excinfo:
@@ -295,7 +296,7 @@ def test_create_table_invalid_name(self):
def test_delete_table_invalid_name(self):
# Arrange
- ts = TableServiceClient(self.account_url(self.tables_cosmos_account_name, "cosmos"), self.tables_primary_cosmos_account_key)
+ ts = TableServiceClient(self.account_url(self.tables_cosmos_account_name, "cosmos"), self.credential)
invalid_table_name = "my_table"
with pytest.raises(ValueError) as excinfo:
@@ -307,7 +308,7 @@ def test_delete_table_invalid_name(self):
def test_unicode_create_table_unicode_name(self):
# Arrange
url = self.account_url(self.tables_cosmos_account_name, "cosmos")
- ts = TableServiceClient(url, self.tables_primary_cosmos_account_key)
+ ts = TableServiceClient(url, self.credential)
table_name = u'啊齄丂狛狜'
# Act
diff --git a/sdk/tables/azure-data-tables/tests/test_table_cosmos_async.py b/sdk/tables/azure-data-tables/tests/test_table_cosmos_async.py
index 72f53706d89d..b29fe43a6e1b 100644
--- a/sdk/tables/azure-data-tables/tests/test_table_cosmos_async.py
+++ b/sdk/tables/azure-data-tables/tests/test_table_cosmos_async.py
@@ -8,7 +8,7 @@
from devtools_testutils import AzureTestCase
-from azure.core.credentials import AzureSasCredential
+from azure.core.credentials import AzureNamedKeyCredential
from azure.core.exceptions import ResourceNotFoundError, ResourceExistsError, HttpResponseError
from azure.data.tables import (
AccessPolicy,
@@ -21,7 +21,7 @@
from _shared.asynctestcase import AsyncTableTestCase
from _shared.testcase import SLEEP_DELAY
-from preparers import CosmosPreparer
+from async_preparers import cosmos_decorator_async
TEST_TABLE_PREFIX = 'pytableasync'
@@ -60,7 +60,7 @@ async def _delete_table(self, ts, table):
pass
# --Test cases for tables --------------------------------------------------
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_create_table(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
ts = TableServiceClient(self.account_url(tables_cosmos_account_name, "cosmos"), tables_primary_cosmos_account_key)
@@ -77,7 +77,7 @@ async def test_create_table(self, tables_cosmos_account_name, tables_primary_cos
if self.is_live:
sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_create_table_fail_on_exist(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
ts = TableServiceClient(self.account_url(tables_cosmos_account_name, "cosmos"), tables_primary_cosmos_account_key)
@@ -95,7 +95,7 @@ async def test_create_table_fail_on_exist(self, tables_cosmos_account_name, tabl
if self.is_live:
sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_query_tables_per_page(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
# account_url = self.account_url(tables_cosmos_account_name, "table")
@@ -128,7 +128,7 @@ async def test_query_tables_per_page(self, tables_cosmos_account_name, tables_pr
if self.is_live:
sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_list_tables(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
ts = TableServiceClient(self.account_url(tables_cosmos_account_name, "cosmos"), tables_primary_cosmos_account_key)
@@ -147,7 +147,7 @@ async def test_list_tables(self, tables_cosmos_account_name, tables_primary_cosm
if self.is_live:
sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_query_tables_with_filter(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
ts = TableServiceClient(self.account_url(tables_cosmos_account_name, "cosmos"), tables_primary_cosmos_account_key)
@@ -167,7 +167,7 @@ async def test_query_tables_with_filter(self, tables_cosmos_account_name, tables
if self.is_live:
sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_list_tables_with_num_results(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._delete_all_tables(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -196,7 +196,7 @@ async def test_list_tables_with_num_results(self, tables_cosmos_account_name, ta
# if self.is_live:
# sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_list_tables_with_marker(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
ts = TableServiceClient(self.account_url(tables_cosmos_account_name, "cosmos"), tables_primary_cosmos_account_key)
@@ -231,7 +231,7 @@ async def test_list_tables_with_marker(self, tables_cosmos_account_name, tables_
if self.is_live:
sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_delete_table_with_existing_table(self, tables_cosmos_account_name,
tables_primary_cosmos_account_key):
# Arrange
@@ -248,7 +248,7 @@ async def test_delete_table_with_existing_table(self, tables_cosmos_account_name
if self.is_live:
sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_delete_table_with_non_existing_table_fail_not_exist(self, tables_cosmos_account_name,
tables_primary_cosmos_account_key):
# Arrange
@@ -266,12 +266,13 @@ async def test_delete_table_with_non_existing_table_fail_not_exist(self, tables_
class TestTableUnitTest(AsyncTableTestCase):
tables_cosmos_account_name = "fake_storage_account"
tables_primary_cosmos_account_key = "fakeXMZjnGsZGvd4bVr3Il5SeHA"
+ credential = AzureNamedKeyCredential(name=tables_cosmos_account_name, key=tables_primary_cosmos_account_key)
@pytest.mark.asyncio
async def test_unicode_create_table_unicode_name(self):
# Arrange
url = self.account_url(self.tables_cosmos_account_name, "cosmos")
- ts = TableServiceClient(url, self.tables_primary_cosmos_account_key)
+ ts = TableServiceClient(url, self.credential)
table_name = u'啊齄丂狛狜'
with pytest.raises(ValueError) as excinfo:
@@ -283,7 +284,7 @@ async def test_unicode_create_table_unicode_name(self):
@pytest.mark.asyncio
async def test_create_table_invalid_name(self):
# Arrange
- ts = TableServiceClient(self.account_url(self.tables_cosmos_account_name, "cosmos"), self.tables_primary_cosmos_account_key)
+ ts = TableServiceClient(self.account_url(self.tables_cosmos_account_name, "cosmos"), self.credential)
invalid_table_name = "my_table"
with pytest.raises(ValueError) as excinfo:
@@ -295,7 +296,7 @@ async def test_create_table_invalid_name(self):
@pytest.mark.asyncio
async def test_delete_table_invalid_name(self):
# Arrange
- ts = TableServiceClient(self.account_url(self.tables_cosmos_account_name, "cosmos"), self.tables_primary_cosmos_account_key)
+ ts = TableServiceClient(self.account_url(self.tables_cosmos_account_name, "cosmos"), self.credential)
invalid_table_name = "my_table"
with pytest.raises(ValueError) as excinfo:
diff --git a/sdk/tables/azure-data-tables/tests/test_table_entity.py b/sdk/tables/azure-data-tables/tests/test_table_entity.py
index 2655bb9a662f..136e66fbf8ea 100644
--- a/sdk/tables/azure-data-tables/tests/test_table_entity.py
+++ b/sdk/tables/azure-data-tables/tests/test_table_entity.py
@@ -18,7 +18,6 @@
from azure.data.tables import (
TableServiceClient,
- TableClient,
generate_table_sas,
TableEntity,
EntityProperty,
@@ -34,11 +33,10 @@
HttpResponseError,
ResourceNotFoundError,
ResourceExistsError,
- ResourceModifiedError,
)
from _shared.testcase import TableTestCase
-from preparers import TablesPreparer
+from preparers import tables_decorator
# ------------------------------------------------------------------------------
@@ -298,7 +296,7 @@ def _assert_valid_metadata(self, metadata):
assert len(keys) == 3
# --Test cases for entities ------------------------------------------
- @TablesPreparer()
+ @tables_decorator
def test_url_encoding_at_symbol(self, tables_storage_account_name, tables_primary_storage_account_key):
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -333,7 +331,7 @@ def test_url_encoding_at_symbol(self, tables_storage_account_name, tables_primar
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_insert_etag(self, tables_storage_account_name, tables_primary_storage_account_key):
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -352,7 +350,7 @@ def test_insert_etag(self, tables_storage_account_name, tables_primary_storage_a
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_query_user_filter(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -375,7 +373,7 @@ def test_query_user_filter(self, tables_storage_account_name, tables_primary_sto
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_query_user_filter_multiple_params(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -399,7 +397,7 @@ def test_query_user_filter_multiple_params(self, tables_storage_account_name, ta
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_query_user_filter_integers(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -422,7 +420,7 @@ def test_query_user_filter_integers(self, tables_storage_account_name, tables_pr
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_query_user_filter_floats(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -445,7 +443,7 @@ def test_query_user_filter_floats(self, tables_storage_account_name, tables_prim
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_query_user_filter_datetimes(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -468,7 +466,7 @@ def test_query_user_filter_datetimes(self, tables_storage_account_name, tables_p
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_query_user_filter_guids(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -491,7 +489,7 @@ def test_query_user_filter_guids(self, tables_storage_account_name, tables_prima
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_query_user_filter_binary(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -514,7 +512,7 @@ def test_query_user_filter_binary(self, tables_storage_account_name, tables_prim
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_query_user_filter_int64(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -544,7 +542,7 @@ def test_query_user_filter_int64(self, tables_storage_account_name, tables_prima
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_query_invalid_filter(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -568,7 +566,7 @@ def test_query_invalid_filter(self, tables_storage_account_name, tables_primary_
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_insert_entity_dictionary(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -583,7 +581,7 @@ def test_insert_entity_dictionary(self, tables_storage_account_name, tables_prim
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_insert_entity_with_hook(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -603,7 +601,7 @@ def test_insert_entity_with_hook(self, tables_storage_account_name, tables_prima
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_insert_entity_with_no_metadata(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -628,7 +626,7 @@ def test_insert_entity_with_no_metadata(self, tables_storage_account_name, table
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_insert_entity_with_full_metadata(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -653,7 +651,7 @@ def test_insert_entity_with_full_metadata(self, tables_storage_account_name, tab
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_insert_entity_conflict(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -668,7 +666,7 @@ def test_insert_entity_conflict(self, tables_storage_account_name, tables_primar
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_insert_entity_with_large_int32_value_throws(self, tables_storage_account_name,
tables_primary_storage_account_key):
# Arrange
@@ -688,7 +686,7 @@ def test_insert_entity_with_large_int32_value_throws(self, tables_storage_accoun
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_insert_entity_with_large_int64_value_throws(self, tables_storage_account_name,
tables_primary_storage_account_key):
# Arrange
@@ -708,7 +706,7 @@ def test_insert_entity_with_large_int64_value_throws(self, tables_storage_accoun
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_insert_entity_with_large_int_success(self, tables_storage_account_name,
tables_primary_storage_account_key):
# Arrange
@@ -734,7 +732,7 @@ def test_insert_entity_with_large_int_success(self, tables_storage_account_name,
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_insert_entity_missing_pk(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -748,7 +746,7 @@ def test_insert_entity_missing_pk(self, tables_storage_account_name, tables_prim
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_insert_entity_empty_string_pk(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -762,7 +760,7 @@ def test_insert_entity_empty_string_pk(self, tables_storage_account_name, tables
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_insert_entity_missing_rk(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -776,7 +774,7 @@ def test_insert_entity_missing_rk(self, tables_storage_account_name, tables_prim
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_insert_entity_empty_string_rk(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -790,7 +788,7 @@ def test_insert_entity_empty_string_rk(self, tables_storage_account_name, tables
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_insert_entity_too_many_properties(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -807,7 +805,7 @@ def test_insert_entity_too_many_properties(self, tables_storage_account_name, ta
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_insert_entity_property_name_too_long(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -823,7 +821,7 @@ def test_insert_entity_property_name_too_long(self, tables_storage_account_name,
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_insert_entity_with_enums(self, tables_storage_account_name,
tables_primary_storage_account_key):
# Arrange
@@ -853,7 +851,7 @@ class Color(Enum):
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_get_entity(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -871,7 +869,7 @@ def test_get_entity(self, tables_storage_account_name, tables_primary_storage_ac
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_get_entity_with_hook(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -893,7 +891,7 @@ def test_get_entity_with_hook(self, tables_storage_account_name, tables_primary_
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_get_entity_if_match(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -920,7 +918,7 @@ def test_get_entity_if_match(self, tables_storage_account_name, tables_primary_s
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_get_entity_full_metadata(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -940,7 +938,7 @@ def test_get_entity_full_metadata(self, tables_storage_account_name, tables_prim
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_get_entity_no_metadata(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -960,7 +958,7 @@ def test_get_entity_no_metadata(self, tables_storage_account_name, tables_primar
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_get_entity_not_existing(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -976,7 +974,7 @@ def test_get_entity_not_existing(self, tables_storage_account_name, tables_prima
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_get_entity_with_special_doubles(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1000,7 +998,7 @@ def test_get_entity_with_special_doubles(self, tables_storage_account_name, tabl
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_update_entity(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1024,7 +1022,7 @@ def test_update_entity(self, tables_storage_account_name, tables_primary_storage
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_update_entity_not_existing(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1040,7 +1038,7 @@ def test_update_entity_not_existing(self, tables_storage_account_name, tables_pr
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_update_entity_with_if_matches(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1061,7 +1059,7 @@ def test_update_entity_with_if_matches(self, tables_storage_account_name, tables
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_update_entity_with_if_doesnt_match(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1079,7 +1077,7 @@ def test_update_entity_with_if_doesnt_match(self, tables_storage_account_name, t
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_insert_or_merge_entity_with_existing_entity(self, tables_storage_account_name,
tables_primary_storage_account_key):
# Arrange
@@ -1098,7 +1096,7 @@ def test_insert_or_merge_entity_with_existing_entity(self, tables_storage_accoun
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_insert_or_merge_entity_with_non_existing_entity(self, tables_storage_account_name,
tables_primary_storage_account_key):
# Arrange
@@ -1118,7 +1116,7 @@ def test_insert_or_merge_entity_with_non_existing_entity(self, tables_storage_ac
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_insert_or_replace_entity_with_existing_entity(self, tables_storage_account_name,
tables_primary_storage_account_key):
# Arrange
@@ -1137,7 +1135,7 @@ def test_insert_or_replace_entity_with_existing_entity(self, tables_storage_acco
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_insert_or_replace_entity_with_non_existing_entity(self, tables_storage_account_name,
tables_primary_storage_account_key):
# Arrange
@@ -1157,7 +1155,7 @@ def test_insert_or_replace_entity_with_non_existing_entity(self, tables_storage_
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_merge_entity(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1175,7 +1173,7 @@ def test_merge_entity(self, tables_storage_account_name, tables_primary_storage_
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_merge_entity_not_existing(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1191,7 +1189,7 @@ def test_merge_entity_not_existing(self, tables_storage_account_name, tables_pri
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_merge_entity_with_if_matches(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1213,7 +1211,7 @@ def test_merge_entity_with_if_matches(self, tables_storage_account_name, tables_
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_merge_entity_with_if_doesnt_match(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1232,7 +1230,7 @@ def test_merge_entity_with_if_doesnt_match(self, tables_storage_account_name, ta
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_delete_entity(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1249,7 +1247,7 @@ def test_delete_entity(self, tables_storage_account_name, tables_primary_storage
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_delete_entity_not_existing(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1264,7 +1262,7 @@ def test_delete_entity_not_existing(self, tables_storage_account_name, tables_pr
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_delete_entity_with_if_matches(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1282,7 +1280,7 @@ def test_delete_entity_with_if_matches(self, tables_storage_account_name, tables
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_delete_entity_with_if_doesnt_match(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1301,7 +1299,7 @@ def test_delete_entity_with_if_doesnt_match(self, tables_storage_account_name, t
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_delete_entity_overloads(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1329,7 +1327,7 @@ def test_delete_entity_overloads(self, tables_storage_account_name, tables_prima
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_delete_entity_overloads_kwargs(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1357,7 +1355,7 @@ def test_delete_entity_overloads_kwargs(self, tables_storage_account_name, table
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_unicode_property_value(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1381,7 +1379,7 @@ def test_unicode_property_value(self, tables_storage_account_name, tables_primar
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_unicode_property_name(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1405,7 +1403,7 @@ def test_unicode_property_name(self, tables_storage_account_name, tables_primary
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_operations_on_entity_with_partition_key_having_single_quote(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
partition_key_with_single_quote = u"a''''b"
@@ -1442,7 +1440,7 @@ def test_operations_on_entity_with_partition_key_having_single_quote(self, table
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_empty_and_spaces_property_value(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1480,7 +1478,7 @@ def test_empty_and_spaces_property_value(self, tables_storage_account_name, tabl
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_none_property_value(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1498,7 +1496,7 @@ def test_none_property_value(self, tables_storage_account_name, tables_primary_s
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_binary_property_value(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1517,7 +1515,7 @@ def test_binary_property_value(self, tables_storage_account_name, tables_primary
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_timezone(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1539,7 +1537,7 @@ def test_timezone(self, tables_storage_account_name, tables_primary_storage_acco
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_query_entities(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1556,7 +1554,7 @@ def test_query_entities(self, tables_storage_account_name, tables_primary_storag
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_query_entities_each_page(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1596,7 +1594,7 @@ def test_query_entities_each_page(self, tables_storage_account_name, tables_prim
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_query_zero_entities(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1611,7 +1609,7 @@ def test_query_zero_entities(self, tables_storage_account_name, tables_primary_s
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_query_entities_full_metadata(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1628,7 +1626,7 @@ def test_query_entities_full_metadata(self, tables_storage_account_name, tables_
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_query_entities_no_metadata(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1645,7 +1643,7 @@ def test_query_entities_no_metadata(self, tables_storage_account_name, tables_pr
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_query_entities_with_filter(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1666,7 +1664,7 @@ def test_query_entities_with_filter(self, tables_storage_account_name, tables_pr
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_query_injection(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1693,7 +1691,7 @@ def test_query_injection(self, tables_storage_account_name, tables_primary_stora
self.ts.delete_table(table_name)
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_query_special_chars(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1734,7 +1732,7 @@ def test_query_special_chars(self, tables_storage_account_name, tables_primary_s
self.ts.delete_table(table_name)
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_query_entities_with_select(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1754,7 +1752,7 @@ def test_query_entities_with_select(self, tables_storage_account_name, tables_pr
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_query_entities_with_top(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1769,7 +1767,7 @@ def test_query_entities_with_top(self, tables_storage_account_name, tables_prima
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_query_entities_with_top_and_next(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1802,7 +1800,7 @@ def test_query_entities_with_top_and_next(self, tables_storage_account_name, tab
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_sas_query(self, tables_storage_account_name, tables_primary_storage_account_key):
# SAS URL is calculated from storage key, so this test runs live only
url = self.account_url(tables_storage_account_name, "table")
@@ -1813,7 +1811,6 @@ def test_sas_query(self, tables_storage_account_name, tables_primary_storage_acc
entity, _ = self._insert_random_entity()
token = self.generate_sas(
generate_table_sas,
- tables_storage_account_name,
tables_primary_storage_account_key,
self.table_name,
permission=TableSasPermissions(read=True),
@@ -1836,7 +1833,7 @@ def test_sas_query(self, tables_storage_account_name, tables_primary_storage_acc
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_sas_add(self, tables_storage_account_name, tables_primary_storage_account_key):
# SAS URL is calculated from storage key, so this test runs live only
url = self.account_url(tables_storage_account_name, "table")
@@ -1845,7 +1842,6 @@ def test_sas_add(self, tables_storage_account_name, tables_primary_storage_accou
# Arrange
token = self.generate_sas(
generate_table_sas,
- tables_storage_account_name,
tables_primary_storage_account_key,
self.table_name,
permission=TableSasPermissions(add=True),
@@ -1870,7 +1866,7 @@ def test_sas_add(self, tables_storage_account_name, tables_primary_storage_accou
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_sas_add_inside_range(self, tables_storage_account_name, tables_primary_storage_account_key):
# SAS URL is calculated from storage key, so this test runs live only
url = self.account_url(tables_storage_account_name, "table")
@@ -1879,7 +1875,6 @@ def test_sas_add_inside_range(self, tables_storage_account_name, tables_primary_
# Arrange
token = self.generate_sas(
generate_table_sas,
- tables_storage_account_name,
tables_primary_storage_account_key,
self.table_name,
permission=TableSasPermissions(add=True),
@@ -1903,7 +1898,7 @@ def test_sas_add_inside_range(self, tables_storage_account_name, tables_primary_
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_sas_add_outside_range(self, tables_storage_account_name, tables_primary_storage_account_key):
# SAS URL is calculated from storage key, so this test runs live only
url = self.account_url(tables_storage_account_name, "table")
@@ -1912,7 +1907,6 @@ def test_sas_add_outside_range(self, tables_storage_account_name, tables_primary
# Arrange
token = self.generate_sas(
generate_table_sas,
- tables_storage_account_name,
tables_primary_storage_account_key,
self.table_name,
permission=TableSasPermissions(add=True),
@@ -1935,7 +1929,7 @@ def test_sas_add_outside_range(self, tables_storage_account_name, tables_primary
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_sas_update(self, tables_storage_account_name, tables_primary_storage_account_key):
# SAS URL is calculated from storage key, so this test runs live only
url = self.account_url(tables_storage_account_name, "table")
@@ -1945,21 +1939,12 @@ def test_sas_update(self, tables_storage_account_name, tables_primary_storage_ac
entity, _ = self._insert_random_entity()
token = self.generate_sas(
generate_table_sas,
- tables_storage_account_name,
tables_primary_storage_account_key,
self.table_name,
permission=TableSasPermissions(update=True),
expiry=datetime.utcnow() + timedelta(hours=1),
)
- # token = generate_table_sas(
- # tables_storage_account_name,
- # tables_primary_storage_account_key,
- # self.table_name,
- # permission=TableSasPermissions(update=True),
- # expiry=datetime.utcnow() + timedelta(hours=1),
- # )
- # Act
service = TableServiceClient(
self.account_url(tables_storage_account_name, "table"),
credential=AzureSasCredential(token),
@@ -1975,7 +1960,7 @@ def test_sas_update(self, tables_storage_account_name, tables_primary_storage_ac
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_sas_delete(self, tables_storage_account_name, tables_primary_storage_account_key):
# SAS URL is calculated from storage key, so this test runs live only
url = self.account_url(tables_storage_account_name, "table")
@@ -1985,7 +1970,6 @@ def test_sas_delete(self, tables_storage_account_name, tables_primary_storage_ac
entity, _ = self._insert_random_entity()
token = self.generate_sas(
generate_table_sas,
- tables_storage_account_name,
tables_primary_storage_account_key,
self.table_name,
permission=TableSasPermissions(delete=True),
@@ -2006,7 +1990,7 @@ def test_sas_delete(self, tables_storage_account_name, tables_primary_storage_ac
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_sas_upper_case_table_name(self, tables_storage_account_name, tables_primary_storage_account_key):
# SAS URL is calculated from storage key, so this test runs live only
url = self.account_url(tables_storage_account_name, "table")
@@ -2025,7 +2009,6 @@ def test_sas_upper_case_table_name(self, tables_storage_account_name, tables_pri
token = self.generate_sas(
generate_table_sas,
- tables_storage_account_name,
tables_primary_storage_account_key,
self.table_name.upper(),
permission=TableSasPermissions(read=True),
@@ -2048,7 +2031,7 @@ def test_sas_upper_case_table_name(self, tables_storage_account_name, tables_pri
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_sas_signed_identifier(self, tables_storage_account_name, tables_primary_storage_account_key):
# SAS URL is calculated from storage key, so this test runs live only
url = self.account_url(tables_storage_account_name, "table")
@@ -2067,7 +2050,6 @@ def test_sas_signed_identifier(self, tables_storage_account_name, tables_primary
token = self.generate_sas(
generate_table_sas,
- tables_storage_account_name,
tables_primary_storage_account_key,
self.table_name,
policy_id='testid'
@@ -2088,7 +2070,7 @@ def test_sas_signed_identifier(self, tables_storage_account_name, tables_primary
finally:
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_datetime_milliseconds(self, tables_storage_account_name, tables_primary_storage_account_key):
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
try:
@@ -2109,7 +2091,7 @@ def test_datetime_milliseconds(self, tables_storage_account_name, tables_primary
self._tear_down()
- @TablesPreparer()
+ @tables_decorator
def test_datetime_str_passthrough(self, tables_storage_account_name, tables_primary_storage_account_key):
self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
partition, row = self._create_pk_rk(None, None)
diff --git a/sdk/tables/azure-data-tables/tests/test_table_entity_async.py b/sdk/tables/azure-data-tables/tests/test_table_entity_async.py
index 06e848e76e15..e5caba04a829 100644
--- a/sdk/tables/azure-data-tables/tests/test_table_entity_async.py
+++ b/sdk/tables/azure-data-tables/tests/test_table_entity_async.py
@@ -35,7 +35,7 @@
from azure.data.tables.aio import TableServiceClient
from _shared.asynctestcase import AsyncTableTestCase
-from preparers import TablesPreparer
+from async_preparers import tables_decorator_async
class StorageTableEntityTest(AzureTestCase, AsyncTableTestCase):
@@ -290,7 +290,7 @@ def _assert_valid_metadata(self, metadata):
# --Test cases for entities ------------------------------------------
- @TablesPreparer()
+ @tables_decorator_async
async def test_url_encoding_at_symbol(self, tables_storage_account_name, tables_primary_storage_account_key):
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -325,7 +325,7 @@ async def test_url_encoding_at_symbol(self, tables_storage_account_name, tables_
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_insert_entity_dictionary(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -340,7 +340,7 @@ async def test_insert_entity_dictionary(self, tables_storage_account_name, table
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_insert_entity_with_hook(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -359,7 +359,7 @@ async def test_insert_entity_with_hook(self, tables_storage_account_name, tables
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_insert_entity_with_no_metadata(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -384,7 +384,7 @@ async def test_insert_entity_with_no_metadata(self, tables_storage_account_name,
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_insert_entity_with_full_metadata(self, tables_storage_account_name,
tables_primary_storage_account_key):
# Arrange
@@ -411,7 +411,7 @@ async def test_insert_entity_with_full_metadata(self, tables_storage_account_nam
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_insert_entity_conflict(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -427,7 +427,7 @@ async def test_insert_entity_conflict(self, tables_storage_account_name, tables_
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_insert_entity_with_large_int32_value_throws(self, tables_storage_account_name,
tables_primary_storage_account_key):
# Arrange
@@ -447,7 +447,7 @@ async def test_insert_entity_with_large_int32_value_throws(self, tables_storage_
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_insert_entity_with_large_int64_value_throws(self, tables_storage_account_name,
tables_primary_storage_account_key):
# Arrange
@@ -467,7 +467,7 @@ async def test_insert_entity_with_large_int64_value_throws(self, tables_storage_
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_insert_entity_with_large_int_success(self, tables_storage_account_name,
tables_primary_storage_account_key):
# Arrange
@@ -493,7 +493,7 @@ async def test_insert_entity_with_large_int_success(self, tables_storage_account
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_insert_entity_missing_pk(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -506,7 +506,7 @@ async def test_insert_entity_missing_pk(self, tables_storage_account_name, table
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_insert_entity_empty_string_pk(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -519,7 +519,7 @@ async def test_insert_entity_empty_string_pk(self, tables_storage_account_name,
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_insert_entity_missing_rk(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -534,7 +534,7 @@ async def test_insert_entity_missing_rk(self, tables_storage_account_name, table
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_insert_entity_empty_string_rk(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -548,7 +548,7 @@ async def test_insert_entity_empty_string_rk(self, tables_storage_account_name,
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_insert_entity_too_many_properties(self, tables_storage_account_name,
tables_primary_storage_account_key):
# Arrange
@@ -565,7 +565,7 @@ async def test_insert_entity_too_many_properties(self, tables_storage_account_na
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_insert_entity_property_name_too_long(self, tables_storage_account_name,
tables_primary_storage_account_key):
# Arrange
@@ -582,7 +582,7 @@ async def test_insert_entity_property_name_too_long(self, tables_storage_account
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_get_entity(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -600,7 +600,7 @@ async def test_get_entity(self, tables_storage_account_name, tables_primary_stor
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_get_entity_with_hook(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -622,7 +622,7 @@ async def test_get_entity_with_hook(self, tables_storage_account_name, tables_pr
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_get_entity_if_match(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -645,7 +645,7 @@ async def test_get_entity_if_match(self, tables_storage_account_name, tables_pri
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_get_entity_full_metadata(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -665,7 +665,7 @@ async def test_get_entity_full_metadata(self, tables_storage_account_name, table
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_get_entity_no_metadata(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -685,7 +685,7 @@ async def test_get_entity_no_metadata(self, tables_storage_account_name, tables_
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_get_entity_not_existing(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -701,7 +701,7 @@ async def test_get_entity_not_existing(self, tables_storage_account_name, tables
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_get_entity_with_special_doubles(self, tables_storage_account_name,
tables_primary_storage_account_key):
# Arrange
@@ -726,7 +726,7 @@ async def test_get_entity_with_special_doubles(self, tables_storage_account_name
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_update_entity(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -748,7 +748,7 @@ async def test_update_entity(self, tables_storage_account_name, tables_primary_s
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_update_entity_not_existing(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -764,7 +764,7 @@ async def test_update_entity_not_existing(self, tables_storage_account_name, tab
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_update_entity_with_if_matches(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -786,7 +786,7 @@ async def test_update_entity_with_if_matches(self, tables_storage_account_name,
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_update_entity_with_if_doesnt_match(self, tables_storage_account_name,
tables_primary_storage_account_key):
# Arrange
@@ -807,7 +807,7 @@ async def test_update_entity_with_if_doesnt_match(self, tables_storage_account_n
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_insert_or_merge_entity_with_existing_entity(self, tables_storage_account_name,
tables_primary_storage_account_key):
# Arrange
@@ -827,7 +827,7 @@ async def test_insert_or_merge_entity_with_existing_entity(self, tables_storage_
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_insert_or_merge_entity_with_non_existing_entity(self, tables_storage_account_name,
tables_primary_storage_account_key):
# Arrange
@@ -847,7 +847,7 @@ async def test_insert_or_merge_entity_with_non_existing_entity(self, tables_stor
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_insert_or_replace_entity_with_existing_entity(self, tables_storage_account_name,
tables_primary_storage_account_key):
# Arrange
@@ -867,7 +867,7 @@ async def test_insert_or_replace_entity_with_existing_entity(self, tables_storag
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_insert_or_replace_entity_with_non_existing_entity(self, tables_storage_account_name,
tables_primary_storage_account_key):
# Arrange
@@ -887,7 +887,7 @@ async def test_insert_or_replace_entity_with_non_existing_entity(self, tables_st
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_merge_entity(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -906,7 +906,7 @@ async def test_merge_entity(self, tables_storage_account_name, tables_primary_st
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_merge_entity_not_existing(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -922,7 +922,7 @@ async def test_merge_entity_not_existing(self, tables_storage_account_name, tabl
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_merge_entity_with_if_matches(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -943,7 +943,7 @@ async def test_merge_entity_with_if_matches(self, tables_storage_account_name, t
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_merge_entity_with_if_doesnt_match(self, tables_storage_account_name,
tables_primary_storage_account_key):
# Arrange
@@ -963,7 +963,7 @@ async def test_merge_entity_with_if_doesnt_match(self, tables_storage_account_na
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_delete_entity(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -980,7 +980,7 @@ async def test_delete_entity(self, tables_storage_account_name, tables_primary_s
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_delete_entity_not_existing(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -995,7 +995,7 @@ async def test_delete_entity_not_existing(self, tables_storage_account_name, tab
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_delete_entity_with_if_matches(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1017,7 +1017,7 @@ async def test_delete_entity_with_if_matches(self, tables_storage_account_name,
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_delete_entity_with_if_doesnt_match(self, tables_storage_account_name,
tables_primary_storage_account_key):
# Arrange
@@ -1038,7 +1038,7 @@ async def test_delete_entity_with_if_doesnt_match(self, tables_storage_account_n
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_delete_entity_overloads(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1066,7 +1066,7 @@ async def test_delete_entity_overloads(self, tables_storage_account_name, tables
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_delete_entity_overloads_kwargs(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1094,7 +1094,7 @@ async def test_delete_entity_overloads_kwargs(self, tables_storage_account_name,
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_unicode_property_value(self, tables_storage_account_name, tables_primary_storage_account_key):
''' regression test for github issue #57'''
# Arrange
@@ -1121,7 +1121,7 @@ async def test_unicode_property_value(self, tables_storage_account_name, tables_
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_unicode_property_name(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1147,7 +1147,7 @@ async def test_unicode_property_name(self, tables_storage_account_name, tables_p
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_operations_on_entity_with_partition_key_having_single_quote(self, tables_storage_account_name, tables_primary_storage_account_key):
partition_key_with_single_quote = u"a''''b"
row_key_with_single_quote = u"a''''b"
@@ -1173,7 +1173,7 @@ async def test_operations_on_entity_with_partition_key_having_single_quote(self,
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_empty_and_spaces_property_value(self, tables_storage_account_name,
tables_primary_storage_account_key):
# Arrange
@@ -1212,7 +1212,7 @@ async def test_empty_and_spaces_property_value(self, tables_storage_account_name
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_none_property_value(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1230,7 +1230,7 @@ async def test_none_property_value(self, tables_storage_account_name, tables_pri
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_binary_property_value(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1249,7 +1249,7 @@ async def test_binary_property_value(self, tables_storage_account_name, tables_p
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_timezone(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1271,7 +1271,7 @@ async def test_timezone(self, tables_storage_account_name, tables_primary_storag
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_query_entities(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1290,7 +1290,7 @@ async def test_query_entities(self, tables_storage_account_name, tables_primary_
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_query_entities_each_page(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1330,7 +1330,7 @@ async def test_query_entities_each_page(self, tables_storage_account_name, table
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_query_injection_async(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1366,7 +1366,7 @@ async def test_query_injection_async(self, tables_storage_account_name, tables_p
await self.ts.delete_table(table_name)
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_query_special_chars(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1425,7 +1425,7 @@ async def test_query_special_chars(self, tables_storage_account_name, tables_pri
await self.ts.delete_table(table_name)
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_query_user_filter(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1445,7 +1445,7 @@ async def test_query_user_filter(self, tables_storage_account_name, tables_prima
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_query_user_filter_multiple_params(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1469,7 +1469,7 @@ async def test_query_user_filter_multiple_params(self, tables_storage_account_na
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_query_user_filter_integers(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1492,7 +1492,7 @@ async def test_query_user_filter_integers(self, tables_storage_account_name, tab
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_query_user_filter_floats(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1515,7 +1515,7 @@ async def test_query_user_filter_floats(self, tables_storage_account_name, table
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_query_user_filter_datetimes(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1538,7 +1538,7 @@ async def test_query_user_filter_datetimes(self, tables_storage_account_name, ta
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_query_user_filter_guids(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1561,7 +1561,7 @@ async def test_query_user_filter_guids(self, tables_storage_account_name, tables
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_query_user_filter_binary(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1584,7 +1584,7 @@ async def test_query_user_filter_binary(self, tables_storage_account_name, table
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_query_user_filter_int64(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1614,7 +1614,7 @@ async def test_query_user_filter_int64(self, tables_storage_account_name, tables
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_query_zero_entities(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1631,7 +1631,7 @@ async def test_query_zero_entities(self, tables_storage_account_name, tables_pri
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_query_entities_full_metadata(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1650,7 +1650,7 @@ async def test_query_entities_full_metadata(self, tables_storage_account_name, t
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_query_entities_no_metadata(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1669,7 +1669,7 @@ async def test_query_entities_no_metadata(self, tables_storage_account_name, tab
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_query_entities_with_filter(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1691,7 +1691,7 @@ async def test_query_entities_with_filter(self, tables_storage_account_name, tab
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_query_invalid_filter(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1713,7 +1713,7 @@ async def test_query_invalid_filter(self, tables_storage_account_name, tables_pr
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_query_entities_with_select(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1735,7 +1735,7 @@ async def test_query_entities_with_select(self, tables_storage_account_name, tab
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_query_entities_with_top(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
@@ -1752,7 +1752,7 @@ async def test_query_entities_with_top(self, tables_storage_account_name, tables
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_query_entities_with_top_and_next(self, tables_storage_account_name,
tables_primary_storage_account_key):
# Arrange
@@ -1788,7 +1788,7 @@ async def test_query_entities_with_top_and_next(self, tables_storage_account_nam
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_sas_query(self, tables_storage_account_name, tables_primary_storage_account_key):
# SAS URL is calculated from storage key, so this test runs live only
url = self.account_url(tables_storage_account_name, "table")
@@ -1799,7 +1799,6 @@ async def test_sas_query(self, tables_storage_account_name, tables_primary_stora
entity, _ = await self._insert_random_entity()
token = self.generate_sas(
generate_table_sas,
- tables_storage_account_name,
tables_primary_storage_account_key,
self.table_name,
permission=TableSasPermissions(read=True),
@@ -1824,7 +1823,7 @@ async def test_sas_query(self, tables_storage_account_name, tables_primary_stora
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_sas_add(self, tables_storage_account_name, tables_primary_storage_account_key):
# SAS URL is calculated from storage key, so this test runs live only
url = self.account_url(tables_storage_account_name, "table")
@@ -1833,7 +1832,6 @@ async def test_sas_add(self, tables_storage_account_name, tables_primary_storage
# Arrange
token = self.generate_sas(
generate_table_sas,
- tables_storage_account_name,
tables_primary_storage_account_key,
self.table_name,
permission=TableSasPermissions(add=True),
@@ -1858,7 +1856,7 @@ async def test_sas_add(self, tables_storage_account_name, tables_primary_storage
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_sas_add_inside_range(self, tables_storage_account_name, tables_primary_storage_account_key):
# SAS URL is calculated from storage key, so this test runs live only
url = self.account_url(tables_storage_account_name, "table")
@@ -1867,7 +1865,6 @@ async def test_sas_add_inside_range(self, tables_storage_account_name, tables_pr
# Arrange
token = self.generate_sas(
generate_table_sas,
- tables_storage_account_name,
tables_primary_storage_account_key,
self.table_name,
permission=TableSasPermissions(add=True),
@@ -1891,7 +1888,7 @@ async def test_sas_add_inside_range(self, tables_storage_account_name, tables_pr
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_sas_add_outside_range(self, tables_storage_account_name, tables_primary_storage_account_key):
# SAS URL is calculated from storage key, so this test runs live only
url = self.account_url(tables_storage_account_name, "table")
@@ -1900,7 +1897,6 @@ async def test_sas_add_outside_range(self, tables_storage_account_name, tables_p
# Arrange
token = self.generate_sas(
generate_table_sas,
- tables_storage_account_name,
tables_primary_storage_account_key,
self.table_name,
permission=TableSasPermissions(add=True),
@@ -1923,7 +1919,7 @@ async def test_sas_add_outside_range(self, tables_storage_account_name, tables_p
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_sas_update(self, tables_storage_account_name, tables_primary_storage_account_key):
# SAS URL is calculated from storage key, so this test runs live only
url = self.account_url(tables_storage_account_name, "table")
@@ -1933,7 +1929,6 @@ async def test_sas_update(self, tables_storage_account_name, tables_primary_stor
entity, _ = await self._insert_random_entity()
token = self.generate_sas(
generate_table_sas,
- tables_storage_account_name,
tables_primary_storage_account_key,
self.table_name,
permission=TableSasPermissions(update=True),
@@ -1958,7 +1953,7 @@ async def test_sas_update(self, tables_storage_account_name, tables_primary_stor
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_sas_delete(self, tables_storage_account_name, tables_primary_storage_account_key):
# SAS URL is calculated from storage key, so this test runs live only
url = self.account_url(tables_storage_account_name, "table")
@@ -1968,7 +1963,6 @@ async def test_sas_delete(self, tables_storage_account_name, tables_primary_stor
entity, _ = await self._insert_random_entity()
token = self.generate_sas(
generate_table_sas,
- tables_storage_account_name,
tables_primary_storage_account_key,
self.table_name,
permission=TableSasPermissions(delete=True),
@@ -1989,7 +1983,7 @@ async def test_sas_delete(self, tables_storage_account_name, tables_primary_stor
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_sas_upper_case_table_name(self, tables_storage_account_name, tables_primary_storage_account_key):
# SAS URL is calculated from storage key, so this test runs live only
url = self.account_url(tables_storage_account_name, "table")
@@ -2001,7 +1995,6 @@ async def test_sas_upper_case_table_name(self, tables_storage_account_name, tabl
# Table names are case insensitive, so simply upper case our existing table name to test
token = self.generate_sas(
generate_table_sas,
- tables_storage_account_name,
tables_primary_storage_account_key,
self.table_name.upper(),
permission=TableSasPermissions(read=True),
@@ -2026,7 +2019,7 @@ async def test_sas_upper_case_table_name(self, tables_storage_account_name, tabl
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_sas_signed_identifier(self, tables_storage_account_name, tables_primary_storage_account_key):
# SAS URL is calculated from storage key, so this test runs live only
url = self.account_url(tables_storage_account_name, "table")
@@ -2045,7 +2038,6 @@ async def test_sas_signed_identifier(self, tables_storage_account_name, tables_p
token = self.generate_sas(
generate_table_sas,
- tables_storage_account_name,
tables_primary_storage_account_key,
self.table_name,
policy_id='testid',
@@ -2068,7 +2060,7 @@ async def test_sas_signed_identifier(self, tables_storage_account_name, tables_p
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_datetime_milliseconds(self, tables_storage_account_name, tables_primary_storage_account_key):
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
try:
@@ -2088,7 +2080,7 @@ async def test_datetime_milliseconds(self, tables_storage_account_name, tables_p
finally:
await self._tear_down()
- @TablesPreparer()
+ @tables_decorator_async
async def test_datetime_str_passthrough(self, tables_storage_account_name, tables_primary_storage_account_key):
await self._set_up(tables_storage_account_name, tables_primary_storage_account_key)
partition, row = self._create_pk_rk(None, None)
diff --git a/sdk/tables/azure-data-tables/tests/test_table_entity_cosmos.py b/sdk/tables/azure-data-tables/tests/test_table_entity_cosmos.py
index 6b482e34e63e..f1933620933a 100644
--- a/sdk/tables/azure-data-tables/tests/test_table_entity_cosmos.py
+++ b/sdk/tables/azure-data-tables/tests/test_table_entity_cosmos.py
@@ -36,7 +36,7 @@
)
from _shared.testcase import TableTestCase, SLEEP_DELAY
-from preparers import CosmosPreparer
+from preparers import cosmos_decorator
# ------------------------------------------------------------------------------
@@ -297,7 +297,7 @@ def _assert_valid_metadata(self, metadata):
assert len(keys) == 3
# --Test cases for entities ------------------------------------------
- @CosmosPreparer()
+ @cosmos_decorator
def test_url_encoding_at_symbol(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -333,7 +333,7 @@ def test_url_encoding_at_symbol(self, tables_cosmos_account_name, tables_primary
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_insert_etag(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -351,7 +351,7 @@ def test_insert_etag(self, tables_cosmos_account_name, tables_primary_cosmos_acc
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_query_user_filter(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -372,7 +372,7 @@ def test_query_user_filter(self, tables_cosmos_account_name, tables_primary_cosm
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_query_user_filter_multiple_params(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -397,7 +397,7 @@ def test_query_user_filter_multiple_params(self, tables_cosmos_account_name, tab
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_query_user_filter_integers(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -421,7 +421,7 @@ def test_query_user_filter_integers(self, tables_cosmos_account_name, tables_pri
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_query_user_filter_floats(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -445,7 +445,7 @@ def test_query_user_filter_floats(self, tables_cosmos_account_name, tables_prima
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_query_user_filter_datetimes(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -469,7 +469,7 @@ def test_query_user_filter_datetimes(self, tables_cosmos_account_name, tables_pr
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_query_user_filter_guids(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -493,7 +493,7 @@ def test_query_user_filter_guids(self, tables_cosmos_account_name, tables_primar
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_query_user_filter_binary(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -516,7 +516,7 @@ def test_query_user_filter_binary(self, tables_cosmos_account_name, tables_prima
finally:
self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator
def test_query_user_filter_int64(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -545,7 +545,7 @@ def test_query_user_filter_int64(self, tables_cosmos_account_name, tables_primar
finally:
self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator
def test_query_invalid_filter(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -570,7 +570,7 @@ def test_query_invalid_filter(self, tables_cosmos_account_name, tables_primary_c
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_insert_entity_dictionary(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -586,7 +586,7 @@ def test_insert_entity_dictionary(self, tables_cosmos_account_name, tables_prima
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_insert_entity_with_hook(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -607,7 +607,7 @@ def test_insert_entity_with_hook(self, tables_cosmos_account_name, tables_primar
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_insert_entity_with_no_metadata(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -633,7 +633,7 @@ def test_insert_entity_with_no_metadata(self, tables_cosmos_account_name, tables
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_insert_entity_with_full_metadata(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -659,7 +659,7 @@ def test_insert_entity_with_full_metadata(self, tables_cosmos_account_name, tabl
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_insert_entity_conflict(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -677,7 +677,7 @@ def test_insert_entity_conflict(self, tables_cosmos_account_name, tables_primary
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_insert_entity_with_large_int32_value_throws(self, tables_cosmos_account_name,
tables_primary_cosmos_account_key):
# Arrange
@@ -698,7 +698,7 @@ def test_insert_entity_with_large_int32_value_throws(self, tables_cosmos_account
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_insert_entity_with_large_int64_value_throws(self, tables_cosmos_account_name,
tables_primary_cosmos_account_key):
# Arrange
@@ -719,7 +719,7 @@ def test_insert_entity_with_large_int64_value_throws(self, tables_cosmos_account
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_insert_entity_with_large_int_success(self, tables_cosmos_account_name,
tables_primary_cosmos_account_key):
# Arrange
@@ -746,7 +746,7 @@ def test_insert_entity_with_large_int_success(self, tables_cosmos_account_name,
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_insert_entity_missing_pk(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -761,7 +761,7 @@ def test_insert_entity_missing_pk(self, tables_cosmos_account_name, tables_prima
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_insert_entity_empty_string_pk(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -778,7 +778,7 @@ def test_insert_entity_empty_string_pk(self, tables_cosmos_account_name, tables_
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_insert_entity_missing_rk(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -794,7 +794,7 @@ def test_insert_entity_missing_rk(self, tables_cosmos_account_name, tables_prima
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_insert_entity_empty_string_rk(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -809,7 +809,7 @@ def test_insert_entity_empty_string_rk(self, tables_cosmos_account_name, tables_
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_get_entity(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -828,7 +828,7 @@ def test_get_entity(self, tables_cosmos_account_name, tables_primary_cosmos_acco
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_get_entity_with_hook(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -851,7 +851,7 @@ def test_get_entity_with_hook(self, tables_cosmos_account_name, tables_primary_c
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_get_entity_if_match(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -875,7 +875,7 @@ def test_get_entity_if_match(self, tables_cosmos_account_name, tables_primary_co
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_get_entity_full_metadata(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -896,7 +896,7 @@ def test_get_entity_full_metadata(self, tables_cosmos_account_name, tables_prima
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_get_entity_no_metadata(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -917,7 +917,7 @@ def test_get_entity_no_metadata(self, tables_cosmos_account_name, tables_primary
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_get_entity_not_existing(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -934,7 +934,7 @@ def test_get_entity_not_existing(self, tables_cosmos_account_name, tables_primar
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_get_entity_with_special_doubles(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -959,7 +959,7 @@ def test_get_entity_with_special_doubles(self, tables_cosmos_account_name, table
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_update_entity(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -981,7 +981,7 @@ def test_update_entity(self, tables_cosmos_account_name, tables_primary_cosmos_a
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_update_entity_not_existing(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -998,7 +998,7 @@ def test_update_entity_not_existing(self, tables_cosmos_account_name, tables_pri
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_update_entity_with_if_matches(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1020,7 +1020,7 @@ def test_update_entity_with_if_matches(self, tables_cosmos_account_name, tables_
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_update_entity_with_if_doesnt_match(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1041,7 +1041,7 @@ def test_update_entity_with_if_doesnt_match(self, tables_cosmos_account_name, ta
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_insert_or_merge_entity_with_existing_entity(self, tables_cosmos_account_name,
tables_primary_cosmos_account_key):
# Arrange
@@ -1061,7 +1061,7 @@ def test_insert_or_merge_entity_with_existing_entity(self, tables_cosmos_account
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_insert_or_merge_entity_with_non_existing_entity(self, tables_cosmos_account_name,
tables_primary_cosmos_account_key):
# Arrange
@@ -1082,7 +1082,7 @@ def test_insert_or_merge_entity_with_non_existing_entity(self, tables_cosmos_acc
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_insert_or_replace_entity_with_existing_entity(self, tables_cosmos_account_name,
tables_primary_cosmos_account_key):
# Arrange
@@ -1102,7 +1102,7 @@ def test_insert_or_replace_entity_with_existing_entity(self, tables_cosmos_accou
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_insert_or_replace_entity_with_non_existing_entity(self, tables_cosmos_account_name,
tables_primary_cosmos_account_key):
# Arrange
@@ -1123,7 +1123,7 @@ def test_insert_or_replace_entity_with_non_existing_entity(self, tables_cosmos_a
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_merge_entity(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1142,7 +1142,7 @@ def test_merge_entity(self, tables_cosmos_account_name, tables_primary_cosmos_ac
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_merge_entity_not_existing(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1159,7 +1159,7 @@ def test_merge_entity_not_existing(self, tables_cosmos_account_name, tables_prim
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_merge_entity_with_if_matches(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1182,7 +1182,7 @@ def test_merge_entity_with_if_matches(self, tables_cosmos_account_name, tables_p
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_merge_entity_with_if_doesnt_match(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1202,7 +1202,7 @@ def test_merge_entity_with_if_doesnt_match(self, tables_cosmos_account_name, tab
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_delete_entity(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1219,7 +1219,7 @@ def test_delete_entity(self, tables_cosmos_account_name, tables_primary_cosmos_a
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_delete_entity_not_existing(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1235,7 +1235,7 @@ def test_delete_entity_not_existing(self, tables_cosmos_account_name, tables_pri
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_delete_entity_with_if_matches(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1257,7 +1257,7 @@ def test_delete_entity_with_if_matches(self, tables_cosmos_account_name, tables_
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_delete_entity_with_if_doesnt_match(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1278,7 +1278,7 @@ def test_delete_entity_with_if_doesnt_match(self, tables_cosmos_account_name, ta
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_delete_entity_overloads(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1306,7 +1306,7 @@ def test_delete_entity_overloads(self, tables_cosmos_account_name, tables_primar
finally:
self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator
def test_delete_entity_overloads_kwargs(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1334,7 +1334,7 @@ def test_delete_entity_overloads_kwargs(self, tables_cosmos_account_name, tables
finally:
self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator
def test_unicode_property_value(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1348,8 +1348,7 @@ def test_unicode_property_value(self, tables_cosmos_account_name, tables_primary
# Act
self.table.create_entity(entity=entity1)
self.table.create_entity(entity=entity2)
- entities = list(self.table.query_entities(
- "PartitionKey eq '{}'".format(entity['PartitionKey'])))
+ entities = list(self.table.query_entities("PartitionKey eq '{}'".format(entity['PartitionKey'])))
# Assert
assert len(entities) == 2
@@ -1359,7 +1358,7 @@ def test_unicode_property_value(self, tables_cosmos_account_name, tables_primary
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_unicode_property_name(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1385,7 +1384,7 @@ def test_unicode_property_name(self, tables_cosmos_account_name, tables_primary_
self.sleep(SLEEP_DELAY)
@pytest.mark.skip("Bad Request: Cosmos cannot handle single quotes in a PK/RK (confirm)")
- @CosmosPreparer()
+ @cosmos_decorator
def test_operations_on_entity_with_partition_key_having_single_quote(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
@@ -1424,7 +1423,7 @@ def test_operations_on_entity_with_partition_key_having_single_quote(self, table
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_empty_and_spaces_property_value(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1462,7 +1461,7 @@ def test_empty_and_spaces_property_value(self, tables_cosmos_account_name, table
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_none_property_value(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1481,7 +1480,7 @@ def test_none_property_value(self, tables_cosmos_account_name, tables_primary_co
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_binary_property_value(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1501,7 +1500,7 @@ def test_binary_property_value(self, tables_cosmos_account_name, tables_primary_
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_timezone(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1524,7 +1523,7 @@ def test_timezone(self, tables_cosmos_account_name, tables_primary_cosmos_accoun
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_query_entities(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1542,7 +1541,7 @@ def test_query_entities(self, tables_cosmos_account_name, tables_primary_cosmos_
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_query_entities_each_page(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1583,7 +1582,7 @@ def test_query_entities_each_page(self, tables_cosmos_account_name, tables_prima
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_query_zero_entities(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1599,7 +1598,7 @@ def test_query_zero_entities(self, tables_cosmos_account_name, tables_primary_co
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_query_entities_full_metadata(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1617,7 +1616,7 @@ def test_query_entities_full_metadata(self, tables_cosmos_account_name, tables_p
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_query_entities_no_metadata(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1635,7 +1634,7 @@ def test_query_entities_no_metadata(self, tables_cosmos_account_name, tables_pri
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_query_entities_with_filter(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1656,7 +1655,7 @@ def test_query_entities_with_filter(self, tables_cosmos_account_name, tables_pri
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_query_injection(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1684,7 +1683,7 @@ def test_query_injection(self, tables_cosmos_account_name, tables_primary_cosmos
self._tear_down()
@pytest.mark.live_test_only
- @CosmosPreparer()
+ @cosmos_decorator
def test_query_special_chars(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1725,7 +1724,7 @@ def test_query_special_chars(self, tables_cosmos_account_name, tables_primary_co
self.ts.delete_table(table_name)
self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator
def test_query_entities_with_select(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1748,7 +1747,7 @@ def test_query_entities_with_select(self, tables_cosmos_account_name, tables_pri
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_query_entities_with_top(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1764,7 +1763,7 @@ def test_query_entities_with_top(self, tables_cosmos_account_name, tables_primar
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_query_entities_with_top_and_next(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1798,7 +1797,7 @@ def test_query_entities_with_top_and_next(self, tables_cosmos_account_name, tabl
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_datetime_milliseconds(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
try:
@@ -1819,7 +1818,7 @@ def test_datetime_milliseconds(self, tables_cosmos_account_name, tables_primary_
self._tear_down()
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_datetime_str_passthrough(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
partition, row = self._create_pk_rk(None, None)
diff --git a/sdk/tables/azure-data-tables/tests/test_table_entity_cosmos_async.py b/sdk/tables/azure-data-tables/tests/test_table_entity_cosmos_async.py
index 70723b4f5acd..c5e013598fcd 100644
--- a/sdk/tables/azure-data-tables/tests/test_table_entity_cosmos_async.py
+++ b/sdk/tables/azure-data-tables/tests/test_table_entity_cosmos_async.py
@@ -37,7 +37,7 @@
from _shared.asynctestcase import AsyncTableTestCase
from _shared.testcase import SLEEP_DELAY
-from preparers import CosmosPreparer
+from async_preparers import cosmos_decorator_async
# ------------------------------------------------------------------------------
# TODO: change to `with table_client as client:` to close sessions
# ------------------------------------------------------------------------------
@@ -295,7 +295,7 @@ def _assert_valid_metadata(self, metadata):
assert len(keys) == 3
# --Test cases for entities ------------------------------------------
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_url_encoding_at_symbol(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -330,7 +330,7 @@ async def test_url_encoding_at_symbol(self, tables_cosmos_account_name, tables_p
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_insert_entity_dictionary(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -345,7 +345,7 @@ async def test_insert_entity_dictionary(self, tables_cosmos_account_name, tables
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_insert_entity_with_hook(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -364,7 +364,7 @@ async def test_insert_entity_with_hook(self, tables_cosmos_account_name, tables_
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_insert_entity_with_no_metadata(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -389,7 +389,7 @@ async def test_insert_entity_with_no_metadata(self, tables_cosmos_account_name,
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_insert_entity_with_full_metadata(self, tables_cosmos_account_name,
tables_primary_cosmos_account_key):
# Arrange
@@ -415,7 +415,7 @@ async def test_insert_entity_with_full_metadata(self, tables_cosmos_account_name
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_insert_entity_conflict(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -430,7 +430,7 @@ async def test_insert_entity_conflict(self, tables_cosmos_account_name, tables_p
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_insert_entity_with_large_int32_value_throws(self, tables_cosmos_account_name,
tables_primary_cosmos_account_key):
# Arrange
@@ -450,7 +450,7 @@ async def test_insert_entity_with_large_int32_value_throws(self, tables_cosmos_a
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_insert_entity_with_large_int64_value_throws(self, tables_cosmos_account_name,
tables_primary_cosmos_account_key):
# Arrange
@@ -470,7 +470,7 @@ async def test_insert_entity_with_large_int64_value_throws(self, tables_cosmos_a
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_insert_entity_with_large_int_success(self, tables_cosmos_account_name,
tables_primary_cosmos_account_key):
# Arrange
@@ -496,7 +496,7 @@ async def test_insert_entity_with_large_int_success(self, tables_cosmos_account_
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_insert_entity_missing_pk(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -510,7 +510,7 @@ async def test_insert_entity_missing_pk(self, tables_cosmos_account_name, tables
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_insert_entity_empty_string_pk(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -523,7 +523,7 @@ async def test_insert_entity_empty_string_pk(self, tables_cosmos_account_name, t
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_insert_entity_missing_rk(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -538,7 +538,7 @@ async def test_insert_entity_missing_rk(self, tables_cosmos_account_name, tables
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_insert_entity_empty_string_rk(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -552,7 +552,7 @@ async def test_insert_entity_empty_string_rk(self, tables_cosmos_account_name, t
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_get_entity(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -570,7 +570,7 @@ async def test_get_entity(self, tables_cosmos_account_name, tables_primary_cosmo
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_get_entity_with_hook(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -590,7 +590,7 @@ async def test_get_entity_with_hook(self, tables_cosmos_account_name, tables_pri
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_get_entity_if_match(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -611,7 +611,7 @@ async def test_get_entity_if_match(self, tables_cosmos_account_name, tables_prim
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_get_entity_full_metadata(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -631,7 +631,7 @@ async def test_get_entity_full_metadata(self, tables_cosmos_account_name, tables
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_get_entity_no_metadata(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -651,7 +651,7 @@ async def test_get_entity_no_metadata(self, tables_cosmos_account_name, tables_p
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_get_entity_not_existing(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -667,7 +667,7 @@ async def test_get_entity_not_existing(self, tables_cosmos_account_name, tables_
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_get_entity_with_special_doubles(self, tables_cosmos_account_name,
tables_primary_cosmos_account_key):
# Arrange
@@ -692,7 +692,7 @@ async def test_get_entity_with_special_doubles(self, tables_cosmos_account_name,
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_update_entity(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -714,7 +714,7 @@ async def test_update_entity(self, tables_cosmos_account_name, tables_primary_co
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_update_entity_not_existing(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -730,7 +730,7 @@ async def test_update_entity_not_existing(self, tables_cosmos_account_name, tabl
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_update_entity_with_if_matches(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -752,7 +752,7 @@ async def test_update_entity_with_if_matches(self, tables_cosmos_account_name, t
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_update_entity_with_if_doesnt_match(self, tables_cosmos_account_name,
tables_primary_cosmos_account_key):
# Arrange
@@ -773,7 +773,7 @@ async def test_update_entity_with_if_doesnt_match(self, tables_cosmos_account_na
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_insert_or_merge_entity_with_existing_entity(self, tables_cosmos_account_name,
tables_primary_cosmos_account_key):
# Arrange
@@ -792,7 +792,7 @@ async def test_insert_or_merge_entity_with_existing_entity(self, tables_cosmos_a
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_insert_or_merge_entity_with_non_existing_entity(self, tables_cosmos_account_name,
tables_primary_cosmos_account_key):
# Arrange
@@ -810,7 +810,7 @@ async def test_insert_or_merge_entity_with_non_existing_entity(self, tables_cosm
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_insert_or_replace_entity_with_existing_entity(self, tables_cosmos_account_name,
tables_primary_cosmos_account_key):
# Arrange
@@ -829,7 +829,7 @@ async def test_insert_or_replace_entity_with_existing_entity(self, tables_cosmos
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_insert_or_replace_entity_with_non_existing_entity(self, tables_cosmos_account_name,
tables_primary_cosmos_account_key):
# Arrange
@@ -846,7 +846,7 @@ async def test_insert_or_replace_entity_with_non_existing_entity(self, tables_co
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_merge_entity(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -863,7 +863,7 @@ async def test_merge_entity(self, tables_cosmos_account_name, tables_primary_cos
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_merge_entity_not_existing(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -879,7 +879,7 @@ async def test_merge_entity_not_existing(self, tables_cosmos_account_name, table
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_merge_entity_with_if_matches(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -898,7 +898,7 @@ async def test_merge_entity_with_if_matches(self, tables_cosmos_account_name, ta
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_merge_entity_with_if_doesnt_match(self, tables_cosmos_account_name,
tables_primary_cosmos_account_key):
# Arrange
@@ -918,7 +918,7 @@ async def test_merge_entity_with_if_doesnt_match(self, tables_cosmos_account_nam
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_delete_entity(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -932,7 +932,7 @@ async def test_delete_entity(self, tables_cosmos_account_name, tables_primary_co
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_delete_entity_not_existing(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -947,7 +947,7 @@ async def test_delete_entity_not_existing(self, tables_cosmos_account_name, tabl
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_delete_entity_with_if_matches(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -966,7 +966,7 @@ async def test_delete_entity_with_if_matches(self, tables_cosmos_account_name, t
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_delete_entity_with_if_doesnt_match(self, tables_cosmos_account_name,
tables_primary_cosmos_account_key):
# Arrange
@@ -985,7 +985,7 @@ async def test_delete_entity_with_if_doesnt_match(self, tables_cosmos_account_na
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_delete_entity_overloads(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1014,7 +1014,7 @@ async def test_delete_entity_overloads(self, tables_cosmos_account_name, tables_
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_delete_entity_overloads_kwargs(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1043,7 +1043,7 @@ async def test_delete_entity_overloads_kwargs(self, tables_cosmos_account_name,
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_unicode_property_value(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
''' regression test for github issue #57'''
# Arrange
@@ -1070,7 +1070,7 @@ async def test_unicode_property_value(self, tables_cosmos_account_name, tables_p
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_unicode_property_name(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1097,7 +1097,7 @@ async def test_unicode_property_name(self, tables_cosmos_account_name, tables_pr
await self._tear_down()
@pytest.mark.skip("Bad Request: Cosmos cannot handle single quotes in a PK/RK (confirm)")
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_operations_on_entity_with_partition_key_having_single_quote(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
partition_key_with_single_quote = "a''''b"
@@ -1124,7 +1124,7 @@ async def test_operations_on_entity_with_partition_key_having_single_quote(self,
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_empty_and_spaces_property_value(self, tables_cosmos_account_name,
tables_primary_cosmos_account_key):
# Arrange
@@ -1163,7 +1163,7 @@ async def test_empty_and_spaces_property_value(self, tables_cosmos_account_name,
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_none_property_value(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1181,7 +1181,7 @@ async def test_none_property_value(self, tables_cosmos_account_name, tables_prim
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_binary_property_value(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1200,7 +1200,7 @@ async def test_binary_property_value(self, tables_cosmos_account_name, tables_pr
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_timezone(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1222,7 +1222,7 @@ async def test_timezone(self, tables_cosmos_account_name, tables_primary_cosmos_
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_query_entities(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1241,7 +1241,7 @@ async def test_query_entities(self, tables_cosmos_account_name, tables_primary_c
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_query_entities_each_page(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1281,7 +1281,7 @@ async def test_query_entities_each_page(self, tables_cosmos_account_name, tables
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_query_user_filter(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1302,7 +1302,7 @@ async def test_query_user_filter(self, tables_cosmos_account_name, tables_primar
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_query_user_filter_multiple_params(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1326,7 +1326,7 @@ async def test_query_user_filter_multiple_params(self, tables_cosmos_account_nam
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_query_user_filter_integers(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1349,7 +1349,7 @@ async def test_query_user_filter_integers(self, tables_cosmos_account_name, tabl
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_query_user_filter_floats(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1372,7 +1372,7 @@ async def test_query_user_filter_floats(self, tables_cosmos_account_name, tables
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_query_user_filter_datetimes(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1395,7 +1395,7 @@ async def test_query_user_filter_datetimes(self, tables_cosmos_account_name, tab
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_query_user_filter_guids(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1418,7 +1418,7 @@ async def test_query_user_filter_guids(self, tables_cosmos_account_name, tables_
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_query_user_filter_binary(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1441,7 +1441,7 @@ async def test_query_user_filter_binary(self, tables_cosmos_account_name, tables
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_query_user_filter_int64(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1471,7 +1471,7 @@ async def test_query_user_filter_int64(self, tables_cosmos_account_name, tables_
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_query_zero_entities(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1488,7 +1488,7 @@ async def test_query_zero_entities(self, tables_cosmos_account_name, tables_prim
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_query_entities_full_metadata(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1507,7 +1507,7 @@ async def test_query_entities_full_metadata(self, tables_cosmos_account_name, ta
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_query_entities_no_metadata(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1526,7 +1526,7 @@ async def test_query_entities_no_metadata(self, tables_cosmos_account_name, tabl
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_query_entities_with_filter(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1548,7 +1548,7 @@ async def test_query_entities_with_filter(self, tables_cosmos_account_name, tabl
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_query_injection_async(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1583,7 +1583,7 @@ async def test_query_injection_async(self, tables_cosmos_account_name, tables_pr
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_query_special_chars(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1641,7 +1641,7 @@ async def test_query_special_chars(self, tables_cosmos_account_name, tables_prim
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_query_invalid_filter(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1663,7 +1663,7 @@ async def test_query_invalid_filter(self, tables_cosmos_account_name, tables_pri
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_query_entities_with_select(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
try:
@@ -1684,7 +1684,7 @@ async def test_query_entities_with_select(self, tables_cosmos_account_name, tabl
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_query_entities_with_top(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
@@ -1699,7 +1699,7 @@ async def test_query_entities_with_top(self, tables_cosmos_account_name, tables_
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_query_entities_with_top_and_next(self, tables_cosmos_account_name,
tables_primary_cosmos_account_key):
# Arrange
@@ -1735,7 +1735,7 @@ async def test_query_entities_with_top_and_next(self, tables_cosmos_account_name
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_datetime_milliseconds(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
try:
@@ -1755,7 +1755,7 @@ async def test_datetime_milliseconds(self, tables_cosmos_account_name, tables_pr
finally:
await self._tear_down()
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_datetime_str_passthrough(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key)
partition, row = self._create_pk_rk(None, None)
diff --git a/sdk/tables/azure-data-tables/tests/test_table_service_properties.py b/sdk/tables/azure-data-tables/tests/test_table_service_properties.py
index 69cf89874978..961b573d39a6 100644
--- a/sdk/tables/azure-data-tables/tests/test_table_service_properties.py
+++ b/sdk/tables/azure-data-tables/tests/test_table_service_properties.py
@@ -20,7 +20,7 @@
from azure.core.exceptions import HttpResponseError
from _shared.testcase import TableTestCase
-from preparers import TablesPreparer
+from preparers import tables_decorator
# ------------------------------------------------------------------------------
@@ -101,7 +101,7 @@ def _assert_retention_equal(self, ret1, ret2):
assert ret1.days == ret2.days
# --Test cases per service ---------------------------------------
- @TablesPreparer()
+ @tables_decorator
def test_table_service_properties(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
url = self.account_url(tables_storage_account_name, "table")
@@ -120,7 +120,7 @@ def test_table_service_properties(self, tables_storage_account_name, tables_prim
self._assert_properties_default(tsc.get_service_properties())
# --Test cases per feature ---------------------------------------
- @TablesPreparer()
+ @tables_decorator
def test_set_logging(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
url = self.account_url(tables_storage_account_name, "table")
@@ -136,7 +136,7 @@ def test_set_logging(self, tables_storage_account_name, tables_primary_storage_a
received_props = tsc.get_service_properties()
self._assert_logging_equal(received_props['analytics_logging'], logging)
- @TablesPreparer()
+ @tables_decorator
def test_set_hour_metrics(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
url = self.account_url(tables_storage_account_name, "table")
@@ -152,7 +152,7 @@ def test_set_hour_metrics(self, tables_storage_account_name, tables_primary_stor
received_props = tsc.get_service_properties()
self._assert_metrics_equal(received_props['hour_metrics'], hour_metrics)
- @TablesPreparer()
+ @tables_decorator
def test_set_minute_metrics(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
url = self.account_url(tables_storage_account_name, "table")
@@ -169,7 +169,7 @@ def test_set_minute_metrics(self, tables_storage_account_name, tables_primary_st
received_props = tsc.get_service_properties()
self._assert_metrics_equal(received_props['minute_metrics'], minute_metrics)
- @TablesPreparer()
+ @tables_decorator
def test_set_cors(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
url = self.account_url(tables_storage_account_name, "table")
@@ -200,7 +200,7 @@ def test_set_cors(self, tables_storage_account_name, tables_primary_storage_acco
self._assert_cors_equal(received_props['cors'], cors)
# --Test cases for errors ---------------------------------------
- @TablesPreparer()
+ @tables_decorator
def test_too_many_cors_rules(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
tsc = TableServiceClient(self.account_url(tables_storage_account_name, "table"), tables_primary_storage_account_key)
@@ -212,7 +212,7 @@ def test_too_many_cors_rules(self, tables_storage_account_name, tables_primary_s
pytest.raises(HttpResponseError,
tsc.set_service_properties, None, None, None, cors)
- @TablesPreparer()
+ @tables_decorator
def test_retention_too_long(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
tsc = TableServiceClient(self.account_url(tables_storage_account_name, "table"), tables_primary_storage_account_key)
diff --git a/sdk/tables/azure-data-tables/tests/test_table_service_properties_async.py b/sdk/tables/azure-data-tables/tests/test_table_service_properties_async.py
index 6faf66eb1999..64a52b976815 100644
--- a/sdk/tables/azure-data-tables/tests/test_table_service_properties_async.py
+++ b/sdk/tables/azure-data-tables/tests/test_table_service_properties_async.py
@@ -16,7 +16,7 @@
from azure.data.tables.aio import TableServiceClient
from _shared.testcase import TableTestCase
-from preparers import TablesPreparer
+from async_preparers import tables_decorator_async
# ------------------------------------------------------------------------------
@@ -97,7 +97,7 @@ def _assert_retention_equal(self, ret1, ret2):
assert ret1.days == ret2.days
# --Test cases per service ---------------------------------------
- @TablesPreparer()
+ @tables_decorator_async
async def test_table_service_properties_async(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
url = self.account_url(tables_storage_account_name, "table")
@@ -116,7 +116,7 @@ async def test_table_service_properties_async(self, tables_storage_account_name,
self._assert_properties_default(await tsc.get_service_properties())
# --Test cases per feature ---------------------------------------
- @TablesPreparer()
+ @tables_decorator_async
async def test_set_logging_async(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
url = self.account_url(tables_storage_account_name, "table")
@@ -132,7 +132,7 @@ async def test_set_logging_async(self, tables_storage_account_name, tables_prima
received_props = await tsc.get_service_properties()
self._assert_logging_equal(received_props['analytics_logging'], logging)
- @TablesPreparer()
+ @tables_decorator_async
async def test_set_hour_metrics_async(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
url = self.account_url(tables_storage_account_name, "table")
@@ -148,7 +148,7 @@ async def test_set_hour_metrics_async(self, tables_storage_account_name, tables_
received_props = await tsc.get_service_properties()
self._assert_metrics_equal(received_props['hour_metrics'], hour_metrics)
- @TablesPreparer()
+ @tables_decorator_async
async def test_set_minute_metrics_async(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
url = self.account_url(tables_storage_account_name, "table")
@@ -165,7 +165,7 @@ async def test_set_minute_metrics_async(self, tables_storage_account_name, table
received_props = await tsc.get_service_properties()
self._assert_metrics_equal(received_props['minute_metrics'], minute_metrics)
- @TablesPreparer()
+ @tables_decorator_async
async def test_set_cors_async(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
url = self.account_url(tables_storage_account_name, "table")
@@ -196,7 +196,7 @@ async def test_set_cors_async(self, tables_storage_account_name, tables_primary_
self._assert_cors_equal(received_props['cors'], cors)
# --Test cases for errors ---------------------------------------
- @TablesPreparer()
+ @tables_decorator_async
async def test_too_many_cors_rules_async(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
tsc = TableServiceClient(self.account_url(tables_storage_account_name, "table"), tables_primary_storage_account_key)
@@ -208,7 +208,7 @@ async def test_too_many_cors_rules_async(self, tables_storage_account_name, tabl
with pytest.raises(HttpResponseError):
await tsc.set_service_properties(None, None, None, cors)
- @TablesPreparer()
+ @tables_decorator_async
async def test_retention_too_long_async(self, tables_storage_account_name, tables_primary_storage_account_key):
# Arrange
tsc = TableServiceClient(self.account_url(tables_storage_account_name, "table"), tables_primary_storage_account_key)
diff --git a/sdk/tables/azure-data-tables/tests/test_table_service_properties_cosmos.py b/sdk/tables/azure-data-tables/tests/test_table_service_properties_cosmos.py
index cb10940789f9..418f7e26d910 100644
--- a/sdk/tables/azure-data-tables/tests/test_table_service_properties_cosmos.py
+++ b/sdk/tables/azure-data-tables/tests/test_table_service_properties_cosmos.py
@@ -21,7 +21,7 @@
)
from _shared.testcase import TableTestCase, SLEEP_DELAY
-from preparers import CosmosPreparer
+from preparers import cosmos_decorator
# ------------------------------------------------------------------------------
class TableServicePropertiesTest(AzureTestCase, TableTestCase):
@@ -100,7 +100,7 @@ def _assert_retention_equal(self, ret1, ret2):
assert ret1.days == ret2.days
# --Test cases for errors ---------------------------------------
- @CosmosPreparer()
+ @cosmos_decorator
def test_too_many_cors_rules(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
tsc = TableServiceClient(self.account_url(tables_cosmos_account_name, "cosmos"), tables_primary_cosmos_account_key)
cors = []
@@ -111,7 +111,7 @@ def test_too_many_cors_rules(self, tables_cosmos_account_name, tables_primary_co
tsc.set_service_properties(None, None, None, cors)
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator
def test_retention_too_long(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
tsc = TableServiceClient(self.account_url(tables_cosmos_account_name, "cosmos"), tables_primary_cosmos_account_key)
minute_metrics = Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=366))
diff --git a/sdk/tables/azure-data-tables/tests/test_table_service_properties_cosmos_async.py b/sdk/tables/azure-data-tables/tests/test_table_service_properties_cosmos_async.py
index f3ff9bac0127..13d6db99df0a 100644
--- a/sdk/tables/azure-data-tables/tests/test_table_service_properties_cosmos_async.py
+++ b/sdk/tables/azure-data-tables/tests/test_table_service_properties_cosmos_async.py
@@ -16,7 +16,7 @@
from _shared.testcase import SLEEP_DELAY
from _shared.asynctestcase import AsyncTableTestCase
-from preparers import CosmosPreparer
+from async_preparers import cosmos_decorator_async
# ------------------------------------------------------------------------------
class TableServicePropertiesTest(AzureTestCase, AsyncTableTestCase):
@@ -95,7 +95,7 @@ def _assert_retention_equal(self, ret1, ret2):
assert ret1.days == ret2.days
# --Test cases for errors ---------------------------------------
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_too_many_cors_rules_async(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
tsc = TableServiceClient(self.account_url(tables_cosmos_account_name, "cosmos"), tables_primary_cosmos_account_key)
@@ -108,7 +108,7 @@ async def test_too_many_cors_rules_async(self, tables_cosmos_account_name, table
await tsc.set_service_properties(None, None, None, cors)
self.sleep(SLEEP_DELAY)
- @CosmosPreparer()
+ @cosmos_decorator_async
async def test_retention_too_long_async(self, tables_cosmos_account_name, tables_primary_cosmos_account_key):
# Arrange
tsc = TableServiceClient(self.account_url(tables_cosmos_account_name, "cosmos"), tables_primary_cosmos_account_key)
diff --git a/sdk/tables/azure-data-tables/tests/test_table_service_stats.py b/sdk/tables/azure-data-tables/tests/test_table_service_stats.py
index 765d9ad6ff10..9995c4627a1c 100644
--- a/sdk/tables/azure-data-tables/tests/test_table_service_stats.py
+++ b/sdk/tables/azure-data-tables/tests/test_table_service_stats.py
@@ -9,7 +9,7 @@
from azure.data.tables import TableServiceClient
from _shared.testcase import TableTestCase
-from preparers import TablesPreparer
+from preparers import tables_decorator
SERVICE_UNAVAILABLE_RESP_BODY = 'unavailableunavailableunavailableunavailable=1.7.1
#override azure-core-tracing-opencensus azure-core<2.0.0,>=1.0.0
#override azure-core-tracing-opentelemetry azure-core<2.0.0,>=1.13.0
#override azure-cosmos azure-core<2.0.0,>=1.0.0
-#override azure-data-tables azure-core<2.0.0,>=1.13.0
+#override azure-data-tables azure-core<2.0.0,>=1.14.0
#override azure-eventhub azure-core<2.0.0,>=1.14.0
#override azure-identity azure-core<2.0.0,>=1.0.0
#override azure-keyvault-administration msrest>=0.6.21