Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
from azure.core.credentials import TokenCredential

_SUPPORTED_API_VERSIONS = ["2019-02-02", "2019-07-07", "2020-12-06"]
_DEV_CONN_STRING = "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1" # pylint: disable=line-too-long


def get_api_version(kwargs, default):
Expand Down Expand Up @@ -347,6 +348,8 @@ def __exit__(self, *args): # pylint: disable=arguments-differ


def parse_connection_str(conn_str, credential, keyword_args):
if conn_str is not None and conn_str.lower() == "usedevelopmentstorage=true":
conn_str = _DEV_CONN_STRING
conn_settings = parse_connection_string(conn_str)
primary = None
secondary = None
Expand Down
13 changes: 12 additions & 1 deletion sdk/tables/azure-data-tables/tests/test_table_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from devtools_testutils import AzureRecordedTestCase, recorded_by_proxy

from azure.data.tables._error import _validate_storage_tablename
from azure.data.tables import TableServiceClient, TableClient, TableTransactionError
from azure.data.tables import TableServiceClient, TableClient
from azure.data.tables import __version__ as VERSION
from azure.core.credentials import AzureNamedKeyCredential, AzureSasCredential

Expand Down Expand Up @@ -649,3 +649,14 @@ def test_validate_storage_tablename(self):
_validate_storage_tablename("a aa")
with pytest.raises(ValueError):
_validate_storage_tablename("1aaa")

def test_use_development_storage(self):
tsc = TableServiceClient.from_connection_string("UseDevelopmentStorage=true")
Comment thread
YalinLi0312 marked this conversation as resolved.
assert tsc.account_name == "devstoreaccount1"
assert tsc.scheme == "http"
assert tsc.credential.named_key.name == "devstoreaccount1"
assert tsc.credential.named_key.key == "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="
assert tsc.url == "http://127.0.0.1:10002/devstoreaccount1"
assert tsc._primary_endpoint == "http://127.0.0.1:10002/devstoreaccount1"
assert tsc._secondary_endpoint == "http://127.0.0.1:10002/devstoreaccount1-secondary"
assert not tsc._cosmos_endpoint
13 changes: 11 additions & 2 deletions sdk/tables/azure-data-tables/tests/test_table_client_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@

from azure.core.credentials import AzureNamedKeyCredential, AzureSasCredential
from azure.data.tables.aio import TableServiceClient, TableClient
from azure.data.tables import TableTransactionError
from azure.data.tables._version import VERSION

from _shared.asynctestcase import AsyncTableTestCase
from async_preparers import tables_decorator_async
from devtools_testutils import AzureTestCase
# ------------------------------------------------------------------------------
SERVICES = {
TableServiceClient: 'table',
Expand Down Expand Up @@ -643,3 +641,14 @@ async def test_create_client_for_azurite(self):
assert table.credential.named_key.name == azurite_credential.named_key.name
assert not table._cosmos_endpoint
assert table.scheme == 'https'

def test_use_development_storage(self):
tsc = TableServiceClient.from_connection_string("UseDevelopmentStorage=true")
assert tsc.account_name == "devstoreaccount1"
assert tsc.scheme == "http"
assert tsc.credential.named_key.name == "devstoreaccount1"
assert tsc.credential.named_key.key == "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="
assert tsc.url == "http://127.0.0.1:10002/devstoreaccount1"
assert tsc._primary_endpoint == "http://127.0.0.1:10002/devstoreaccount1"
assert tsc._secondary_endpoint == "http://127.0.0.1:10002/devstoreaccount1-secondary"
assert not tsc._cosmos_endpoint
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from _shared.asynctestcase import AsyncTableTestCase
from _shared.testcase import SLEEP_DELAY
from async_preparers import cosmos_decorator_async
from devtools_testutils import AzureTestCase

# ------------------------------------------------------------------------------

Expand Down