Skip to content

Commit a31472b

Browse files
authored
[T2 aiotest] storage (#11628)
* add aio test * fix private endpoint connection test * remove old recording * add .result for async poller
1 parent 2989c0d commit a31472b

File tree

5 files changed

+4124
-401
lines changed

5 files changed

+4124
-401
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import asyncio
2+
from unittest.mock import Mock
3+
4+
from azure.core.credentials import AccessToken
5+
from azure.identity.aio import DefaultAzureCredential
6+
from devtools_testutils import AzureMgmtTestCase
7+
8+
class AzureMgmtAsyncTestCase(AzureMgmtTestCase):
9+
10+
def setUp(self):
11+
super(AzureMgmtAsyncTestCase, self).setUp()
12+
13+
@property
14+
def event_loop(self):
15+
return asyncio.get_event_loop()
16+
17+
def create_mgmt_aio_client(self, client, **kwargs):
18+
if self.is_live:
19+
credential = DefaultAzureCredential()
20+
else:
21+
credential = Mock(get_token=asyncio.coroutine(lambda _: AccessToken("fake-token", 0)))
22+
return client(
23+
credential=credential,
24+
subscription_id=self.settings.SUBSCRIPTION_ID
25+
)
26+
27+
def to_list(self, ait):
28+
async def lst():
29+
result = []
30+
async for item in ait:
31+
result.append(item)
32+
return result
33+
return self.event_loop.run_until_complete(lst())

0 commit comments

Comments
 (0)