-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aa29772
commit d8e0aa7
Showing
4 changed files
with
31 additions
and
25 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
sdk/communication/azure-communication-administration/tests/_shared/fake_token_credential.py
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,13 @@ | ||
# ------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for | ||
# license information. | ||
# -------------------------------------------------------------------------- | ||
from azure.core.credentials import AccessToken | ||
|
||
class FakeTokenCredential(object): | ||
def __init__(self): | ||
self.token = AccessToken("Fake Token", 0) | ||
|
||
def get_token(self, *args): | ||
return self.token |
14 changes: 14 additions & 0 deletions
14
sdk/communication/azure-communication-administration/tests/_shared/utils.py
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,14 @@ | ||
# ------------------------------------------------------------------------ | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for | ||
# license information. | ||
# ------------------------------------------------------------------------- | ||
from .fake_token_credential import FakeTokenCredential | ||
from azure.identity import DefaultAzureCredential | ||
|
||
def create_token_credential(): | ||
# type: () -> FakeTokenCredential or DefaultAzureCredential | ||
from devtools_testutils import is_live | ||
if not is_live(): | ||
return FakeTokenCredential() | ||
return DefaultAzureCredential() |
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
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