Skip to content

Commit ef38e3a

Browse files
author
Yalin Li
authored
Update tests (Azure#28627)
1 parent 791643c commit ef38e3a

File tree

5 files changed

+14
-31
lines changed

5 files changed

+14
-31
lines changed

sdk/tables/azure-data-tables/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "python",
44
"TagPrefix": "python/tables/azure-data-tables",
5-
"Tag": "python/tables/azure-data-tables_9a03fa14fd"
5+
"Tag": "python/tables/azure-data-tables_15f681b7d2"
66
}

sdk/tables/azure-data-tables/tests/_shared/asynctestcase.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ class AsyncTableTestCase(TableTestCase):
4242
def get_token_credential(self):
4343
if is_live():
4444
return DefaultAzureCredential()
45-
return self.generate_fake_token()
45+
return self.generate_fake_token_credential()
4646

47-
def generate_fake_token(self):
47+
def generate_fake_token_credential(self):
4848
return AsyncFakeTokenCredential()
4949

5050
def _get_table_reference(self, prefix=TEST_TABLE_PREFIX):

sdk/tables/azure-data-tables/tests/_shared/testcase.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ def generate_sas_token(self):
109109
def get_token_credential(self):
110110
if is_live():
111111
return DefaultAzureCredential()
112-
return self.generate_fake_token()
112+
return self.generate_fake_token_credential()
113113

114-
def generate_fake_token(self):
114+
def generate_fake_token_credential(self):
115115
return FakeTokenCredential()
116116

117117
def _get_table_reference(self, prefix=TEST_TABLE_PREFIX):

sdk/tables/azure-data-tables/tests/test_table_entity.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
UpdateMode
2727
)
2828
from azure.data.tables._common_conversion import TZ_UTC
29-
from azure.identity import DefaultAzureCredential
3029

3130
from azure.core import MatchConditions
3231
from azure.core.credentials import AzureSasCredential
@@ -2254,17 +2253,10 @@ def test_upsert_entity_with_invalid_key_type(self, tables_storage_account_name,
22542253
self._tear_down()
22552254

22562255
@tables_decorator
2256+
@recorded_by_proxy
22572257
def test_list_tables_with_invalid_credential(self, tables_storage_account_name, tables_primary_storage_account_key):
22582258
account_url = self.account_url(tables_storage_account_name, "table")
2259-
credential = DefaultAzureCredential(
2260-
exclude_environment_credential=True,
2261-
exclude_managed_identity_credential=False,
2262-
exclude_shared_token_cache_credential=True,
2263-
exclude_visual_studio_code_credential=True,
2264-
exclude_cli_credential=True,
2265-
exclude_interactive_browser_credential=True,
2266-
exclude_powershell_credential=True,
2267-
)
2259+
credential = self.generate_fake_token_credential()
22682260
client = TableServiceClient(credential=credential, endpoint=account_url, api_version="2020-12-06")
22692261
with pytest.raises(ClientAuthenticationError):
22702262
for _ in client.list_tables():

sdk/tables/azure-data-tables/tests/test_table_entity_async.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
# Licensed under the MIT License. See License.txt in the project root for
66
# license information.
77
# --------------------------------------------------------------------------
8-
from uuid import UUID
98
import pytest
109

1110
from datetime import datetime, timedelta
1211
from dateutil.tz import tzutc, tzoffset
1312
from math import isnan
13+
from uuid import UUID
1414

1515
from devtools_testutils import AzureRecordedTestCase
1616
from devtools_testutils.aio import recorded_by_proxy_async
@@ -36,7 +36,6 @@
3636
)
3737
from azure.data.tables.aio import TableServiceClient
3838
from azure.data.tables._common_conversion import TZ_UTC
39-
from azure.identity.aio import DefaultAzureCredential
4039

4140
from _shared.asynctestcase import AsyncTableTestCase
4241
from async_preparers import tables_decorator_async
@@ -2250,19 +2249,11 @@ async def test_upsert_entity_with_invalid_key_type(self, tables_storage_account_
22502249
await self._tear_down()
22512250

22522251
@tables_decorator_async
2252+
@recorded_by_proxy_async
22532253
async def test_list_tables_with_invalid_credential(self, tables_storage_account_name, tables_primary_storage_account_key):
22542254
account_url = self.account_url(tables_storage_account_name, "table")
2255-
credential = DefaultAzureCredential(
2256-
exclude_environment_credential=True,
2257-
exclude_managed_identity_credential=False,
2258-
exclude_shared_token_cache_credential=True,
2259-
exclude_visual_studio_code_credential=True,
2260-
exclude_cli_credential=True,
2261-
exclude_interactive_browser_credential=True,
2262-
exclude_powershell_credential=True,
2263-
)
2264-
async with credential:
2265-
client = TableServiceClient(credential=credential, endpoint=account_url, api_version="2020-12-06")
2266-
with pytest.raises(ClientAuthenticationError):
2267-
async for _ in client.list_tables():
2268-
pass
2255+
credential = self.generate_fake_token_credential()
2256+
client = TableServiceClient(credential=credential, endpoint=account_url, api_version="2020-12-06")
2257+
with pytest.raises(ClientAuthenticationError):
2258+
async for _ in client.list_tables():
2259+
pass

0 commit comments

Comments
 (0)