Skip to content

Commit

Permalink
[T2 aiotest] network (#11729)
Browse files Browse the repository at this point in the history
* add aio test

* enable network watcher test
  • Loading branch information
00Kai0 authored and Zim Kalinowski committed Jun 6, 2020
1 parent 96c3b74 commit f781575
Show file tree
Hide file tree
Showing 10 changed files with 24,452 additions and 39 deletions.
33 changes: 33 additions & 0 deletions sdk/network/azure-mgmt-network/tests/_aio_testcase.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import asyncio
from unittest.mock import Mock

from azure.core.credentials import AccessToken
from azure.identity.aio import DefaultAzureCredential
from devtools_testutils import AzureMgmtTestCase

class AzureMgmtAsyncTestCase(AzureMgmtTestCase):

def setUp(self):
super(AzureMgmtAsyncTestCase, self).setUp()

@property
def event_loop(self):
return asyncio.get_event_loop()

def create_mgmt_aio_client(self, client, **kwargs):
if self.is_live:
credential = DefaultAzureCredential()
else:
credential = Mock(get_token=asyncio.coroutine(lambda _: AccessToken("fake-token", 0)))
return client(
credential=credential,
subscription_id=self.settings.SUBSCRIPTION_ID
)

def to_list(self, ait):
async def lst():
result = []
async for item in ait:
result.append(item)
return result
return self.event_loop.run_until_complete(lst())

Large diffs are not rendered by default.

Loading

0 comments on commit f781575

Please sign in to comment.