-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add aio test * enable network watcher test
- Loading branch information
Showing
10 changed files
with
24,452 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) |
443 changes: 443 additions & 0 deletions
443
...rk/azure-mgmt-network/tests/recordings/test_cli_mgmt_network_base_async.test_network.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.