-
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.
[Communication] - Phone Number Management - Added support for AAD auth (
#16075) * Added support for AAD auth * added successful test recording * Addressed comments * Edited readme * Fixed README
- Loading branch information
1 parent
ab3a17d
commit 1c69e0c
Showing
10 changed files
with
138 additions
and
9 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
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
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
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() |
34 changes: 34 additions & 0 deletions
34
...phone_number_administration_client.test_list_all_phone_numbers_from_managed_identity.yaml
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,34 @@ | ||
interactions: | ||
- request: | ||
body: null | ||
headers: | ||
Accept: | ||
- application/json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
User-Agent: | ||
- azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) | ||
method: GET | ||
uri: https://sanitized.communication.azure.com/administration/phonenumbers/phonenumbers?locale=en-US&skip=0&take=100&api-version=2020-07-20-preview1 | ||
response: | ||
body: | ||
string: '{"phoneNumbers": "sanitized", "nextLink": null}' | ||
headers: | ||
content-type: | ||
- application/json; charset=utf-8 | ||
date: | ||
- Thu, 28 Jan 2021 18:48:48 GMT | ||
ms-cv: | ||
- /rMw3sZH40i74G71li+lDA.0 | ||
request-context: | ||
- appId= | ||
transfer-encoding: | ||
- chunked | ||
x-processing-time: | ||
- 1124ms | ||
status: | ||
code: 200 | ||
message: OK | ||
version: 1 |
25 changes: 25 additions & 0 deletions
25
...number_administration_client_async.test_list_all_phone_numbers_from_managed_identity.yaml
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,25 @@ | ||
interactions: | ||
- request: | ||
body: null | ||
headers: | ||
Accept: | ||
- application/json | ||
User-Agent: | ||
- azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) | ||
method: GET | ||
uri: https://sanitized.communication.azure.com/administration/phonenumbers/phonenumbers?locale=en-US&skip=0&take=100&api-version=2020-07-20-preview1 | ||
response: | ||
body: | ||
string: '{"phoneNumbers": "sanitized", "nextLink": null}' | ||
headers: | ||
content-type: application/json; charset=utf-8 | ||
date: Thu, 28 Jan 2021 18:49:47 GMT | ||
ms-cv: jqpEP/JsFUKDau9Y0tMhbw.0 | ||
request-context: appId= | ||
transfer-encoding: chunked | ||
x-processing-time: 765ms | ||
status: | ||
code: 200 | ||
message: OK | ||
url: https://sanitized.communication.azure.com/administration/phonenumbers/phonenumbers?locale=en-US&skip=0&take=100&api-version=2020-07-20-preview1 | ||
version: 1 |
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